stellar-ui-plus 1.22.3 → 1.22.6
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.
|
@@ -21,6 +21,16 @@
|
|
|
21
21
|
"description": "更新API地址",
|
|
22
22
|
"type": "string",
|
|
23
23
|
"default": "https://zboa.whzb.com/inte-cloud-dev/blade-system/api/inte/client/ver/currentDetail"
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
"name": "[event]cancel",
|
|
27
|
+
"description": "取消更新",
|
|
28
|
+
"type": "() => void"
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
"name": "[event]complete",
|
|
32
|
+
"description": "取消,成功更新都会执行",
|
|
33
|
+
"type": "() => void"
|
|
24
34
|
}
|
|
25
35
|
]
|
|
26
36
|
}
|
|
@@ -20,6 +20,12 @@ const percent = ref(0);
|
|
|
20
20
|
const updateBtn = ref(true);
|
|
21
21
|
const downloadedSize = ref('0');
|
|
22
22
|
const packageFileSize = ref('0');
|
|
23
|
+
|
|
24
|
+
const emits = defineEmits<{
|
|
25
|
+
(e: 'cancel', event?: any): void;
|
|
26
|
+
(e: 'complete', event?: any): void;
|
|
27
|
+
}>();
|
|
28
|
+
|
|
23
29
|
const getData = (callback?: (resVersion: { name: string; code: string; updateFile: string }, version: string) => void) => {
|
|
24
30
|
uni.request({
|
|
25
31
|
url: props.apiUrl,
|
|
@@ -46,6 +52,7 @@ const getData = (callback?: (resVersion: { name: string; code: string; updateFil
|
|
|
46
52
|
if (data.updateFile && data.code > version.value) {
|
|
47
53
|
open.value = true;
|
|
48
54
|
}
|
|
55
|
+
emits('complete');
|
|
49
56
|
} else {
|
|
50
57
|
console.log(_data.msg);
|
|
51
58
|
}
|
|
@@ -94,6 +101,12 @@ const confirm = () => {
|
|
|
94
101
|
}
|
|
95
102
|
};
|
|
96
103
|
|
|
104
|
+
function close() {
|
|
105
|
+
open.value = false;
|
|
106
|
+
emits('cancel');
|
|
107
|
+
emits('complete');
|
|
108
|
+
}
|
|
109
|
+
|
|
97
110
|
defineExpose({
|
|
98
111
|
start,
|
|
99
112
|
stop() {
|
|
@@ -130,7 +143,7 @@ defineExpose({
|
|
|
130
143
|
</view>
|
|
131
144
|
</view>
|
|
132
145
|
|
|
133
|
-
<image v-if="!data.isForce" class="close-img" src="../../static/app_update_close.png" @click.stop="
|
|
146
|
+
<image v-if="!data.isForce" class="close-img" src="../../static/app_update_close.png" @click.stop="close"></image>
|
|
134
147
|
</view>
|
|
135
148
|
</view>
|
|
136
149
|
</template>
|
package/package.json
CHANGED
package/utils/utils.ts
CHANGED
|
@@ -18,6 +18,8 @@ type PartType = 0 | 1 | 2;
|
|
|
18
18
|
let throLast: number = 0;
|
|
19
19
|
let throTimer: ReturnType<typeof setTimeout> | null = null;
|
|
20
20
|
|
|
21
|
+
let debounceTimer: ReturnType<typeof setTimeout> | null = null;
|
|
22
|
+
|
|
21
23
|
let windowWidth: number = 0;
|
|
22
24
|
|
|
23
25
|
// 定义延迟选项接口
|
|
@@ -75,7 +77,7 @@ const utils = {
|
|
|
75
77
|
* @param args 要防抖方法的参数,如果最后一个参数是 {delay:2000},则该参数为防抖时间参数,不记入方法参数
|
|
76
78
|
* @returns 返回一个新的函数
|
|
77
79
|
*/
|
|
78
|
-
debounce<T extends (...args: any[]) => any>(fn: T, ...args: any[]):
|
|
80
|
+
debounce<T extends (...args: any[]) => any>(fn: T, ...args: any[]): void {
|
|
79
81
|
let delay: number = 500;
|
|
80
82
|
let lastArg: any = null;
|
|
81
83
|
|
|
@@ -87,16 +89,22 @@ const utils = {
|
|
|
87
89
|
}
|
|
88
90
|
}
|
|
89
91
|
|
|
90
|
-
let timer: ReturnType<typeof setTimeout> | null = null;
|
|
91
|
-
|
|
92
|
-
return function (this: any): void {
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
};
|
|
92
|
+
// let timer: ReturnType<typeof setTimeout> | null = null;
|
|
93
|
+
|
|
94
|
+
// return function (this: any): void {
|
|
95
|
+
// if (debounceTimer !== null) {
|
|
96
|
+
// clearTimeout(debounceTimer);
|
|
97
|
+
// }
|
|
98
|
+
// debounceTimer = setTimeout(() => {
|
|
99
|
+
// fn.call(this, ...args);
|
|
100
|
+
// }, delay);
|
|
101
|
+
// };
|
|
102
|
+
if (debounceTimer !== null) {
|
|
103
|
+
clearTimeout(debounceTimer);
|
|
104
|
+
}
|
|
105
|
+
debounceTimer = setTimeout(() => {
|
|
106
|
+
fn.call(this, ...args);
|
|
107
|
+
}, delay);
|
|
100
108
|
},
|
|
101
109
|
isNaN(value: number | string | null | undefined): boolean {
|
|
102
110
|
const deg = /^-?\d+(\.\d+)?$/i;
|