hy-app 0.2.10 → 0.2.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/hy-action-sheet/hy-action-sheet.vue +9 -3
- package/components/hy-action-sheet/props.ts +2 -2
- package/components/hy-action-sheet/typing.d.ts +49 -16
- package/components/hy-button/hy-button.vue +37 -11
- package/components/hy-button/props.ts +20 -20
- package/components/hy-button/typing.d.ts +65 -32
- package/components/hy-popover/hy-popover.vue +6 -1
- package/components/hy-popover/typing.d.ts +4 -0
- package/global.d.ts +101 -0
- package/package.json +22 -43
- package/shims-vue.d.ts +0 -0
- package/web-types.config.js +8 -0
- package/web-types.json +3117 -0
- package/components/dialog/TheDialog.vue +0 -128
- package/components/dialog/index.ts +0 -38
|
@@ -1,128 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<view class="dialog dialog-shade">
|
|
3
|
-
<view class="dialog-container">
|
|
4
|
-
<u-image
|
|
5
|
-
class="dialog-container__icon"
|
|
6
|
-
bgColor="transparent"
|
|
7
|
-
:src="icon"
|
|
8
|
-
:width="140"
|
|
9
|
-
:height="140"
|
|
10
|
-
></u-image>
|
|
11
|
-
<view class="dialog-container__title">{{ title }}</view>
|
|
12
|
-
<view class="dialog-container__content">{{ content }}</view>
|
|
13
|
-
|
|
14
|
-
<view class="dialog-container__btn">
|
|
15
|
-
<u-button
|
|
16
|
-
v-if="showCancel"
|
|
17
|
-
:text="cancelText"
|
|
18
|
-
:color="cancelColor"
|
|
19
|
-
:shape="shape"
|
|
20
|
-
size="large"
|
|
21
|
-
@click="result(false)"
|
|
22
|
-
></u-button>
|
|
23
|
-
<u-button
|
|
24
|
-
:text="confirmText"
|
|
25
|
-
:color="confirmColor"
|
|
26
|
-
:shape="shape"
|
|
27
|
-
size="large"
|
|
28
|
-
@click="result(true)"
|
|
29
|
-
></u-button>
|
|
30
|
-
</view>
|
|
31
|
-
</view>
|
|
32
|
-
</view>
|
|
33
|
-
</template>
|
|
34
|
-
|
|
35
|
-
<script lang="ts" setup>
|
|
36
|
-
/**
|
|
37
|
-
* @用途
|
|
38
|
-
* @author Pino
|
|
39
|
-
* @创建时间 2023-01-11 15:19
|
|
40
|
-
**/
|
|
41
|
-
import dialog from "./index";
|
|
42
|
-
|
|
43
|
-
export interface DialogParam {
|
|
44
|
-
icon?: string;
|
|
45
|
-
title?: string;
|
|
46
|
-
content?: string;
|
|
47
|
-
confirmText?: string;
|
|
48
|
-
cancelText?: string;
|
|
49
|
-
shape?: "circle" | "square";
|
|
50
|
-
confirmColor?: string;
|
|
51
|
-
cancelColor?: string;
|
|
52
|
-
showCancel?: boolean;
|
|
53
|
-
result?: Function; // 回调用户操作结果
|
|
54
|
-
}
|
|
55
|
-
const props = withDefaults(defineProps<DialogParam>(), {
|
|
56
|
-
icon: "https://pic1.imgdb.cn/item/67a74cbdd0e0a243d4fd160b.png",
|
|
57
|
-
title: "提示",
|
|
58
|
-
content: "",
|
|
59
|
-
confirmText: "确认",
|
|
60
|
-
cancelText: "取消",
|
|
61
|
-
shape: "circle",
|
|
62
|
-
confirmColor: "#906FFE",
|
|
63
|
-
cancelColor: "",
|
|
64
|
-
showCancel: false,
|
|
65
|
-
result: () => {}
|
|
66
|
-
});
|
|
67
|
-
|
|
68
|
-
const close = () => dialog.close();
|
|
69
|
-
|
|
70
|
-
const result = (isSure: boolean) => {
|
|
71
|
-
console.log(props);
|
|
72
|
-
console.log(props.result);
|
|
73
|
-
if (props.result)
|
|
74
|
-
props.result({
|
|
75
|
-
confirm: isSure,
|
|
76
|
-
cancel: isSure
|
|
77
|
-
});
|
|
78
|
-
close();
|
|
79
|
-
};
|
|
80
|
-
</script>
|
|
81
|
-
|
|
82
|
-
<style lang="scss" scoped>
|
|
83
|
-
.dialog {
|
|
84
|
-
position: fixed;
|
|
85
|
-
z-index: 999999;
|
|
86
|
-
&-shade {
|
|
87
|
-
top: 0;
|
|
88
|
-
width: 100%;
|
|
89
|
-
height: 100%;
|
|
90
|
-
background: rgba(0, 0, 0, 0.5);
|
|
91
|
-
}
|
|
92
|
-
&-container {
|
|
93
|
-
position: absolute;
|
|
94
|
-
transform: translate(-50%, -50%);
|
|
95
|
-
left: 50%;
|
|
96
|
-
top: 50%;
|
|
97
|
-
border-radius: 40px;
|
|
98
|
-
background: #ffffff;
|
|
99
|
-
width: 90%;
|
|
100
|
-
//height: 300px;
|
|
101
|
-
padding: 40px 20px;
|
|
102
|
-
text-align: center;
|
|
103
|
-
|
|
104
|
-
&__icon {
|
|
105
|
-
position: absolute;
|
|
106
|
-
top: -100px;
|
|
107
|
-
left: 50%;
|
|
108
|
-
transform: translateX(-50%);
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
&__title {
|
|
112
|
-
margin: 20px 0;
|
|
113
|
-
font-size: 50rpx;
|
|
114
|
-
}
|
|
115
|
-
&__content {
|
|
116
|
-
margin: 20px 0;
|
|
117
|
-
font-size: 30rpx;
|
|
118
|
-
color: #c3d8db;
|
|
119
|
-
}
|
|
120
|
-
&__btn {
|
|
121
|
-
display: flex;
|
|
122
|
-
.u-button {
|
|
123
|
-
margin: 30px 10px 20px;
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
</style>
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { createApp } from "vue";
|
|
2
|
-
import AlertDialogCom, { type DialogParam } from "./TheDialog.vue";
|
|
3
|
-
import type { ResultParam } from "../../typing";
|
|
4
|
-
|
|
5
|
-
export default class Dialog {
|
|
6
|
-
private static mountNode: HTMLElement | null = null;
|
|
7
|
-
|
|
8
|
-
public static show(param: DialogParam) {
|
|
9
|
-
let app = createApp(AlertDialogCom, { ...param });
|
|
10
|
-
this.mountNode = document.createElement("div");
|
|
11
|
-
app.mount(this.mountNode);
|
|
12
|
-
document.body.appendChild(this.mountNode);
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
// await用法
|
|
16
|
-
// let res = await DialogAialog.showByAwait({
|
|
17
|
-
// title: '提示',
|
|
18
|
-
// content: '确定要作废该条订单吗?',
|
|
19
|
-
// })
|
|
20
|
-
// if (res.confirm) {
|
|
21
|
-
//
|
|
22
|
-
// } else if (res.cancle) {
|
|
23
|
-
// console.log('web', '用户取消')
|
|
24
|
-
// }
|
|
25
|
-
public static showByAwait(param: DialogParam): Promise<ResultParam> {
|
|
26
|
-
return new Promise((resolve, reject) => {
|
|
27
|
-
param.result = (res: ResultParam) => resolve(res);
|
|
28
|
-
this.show(param);
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
public static close() {
|
|
33
|
-
if (!this.mountNode) return;
|
|
34
|
-
document.body.removeChild(this.mountNode);
|
|
35
|
-
this.mountNode = null;
|
|
36
|
-
// console.log('close', 'DialogAialog已销毁')
|
|
37
|
-
}
|
|
38
|
-
}
|