uniky 1.0.27 → 1.0.28
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/package.json
CHANGED
|
@@ -61,17 +61,14 @@ const props = defineProps<{
|
|
|
61
61
|
}>();
|
|
62
62
|
|
|
63
63
|
let value = IconMap[props.name] || "";
|
|
64
|
-
value = value.replace("&#x", "
|
|
65
|
-
value = unescape(value);
|
|
64
|
+
value = String.fromCodePoint(parseInt(value.replace("&#x", "").replace(";", ""), 16));
|
|
66
65
|
const icon = ref(value);
|
|
67
66
|
|
|
68
67
|
watch(
|
|
69
68
|
() => props.name,
|
|
70
69
|
(val) => {
|
|
71
70
|
let iconStr = IconMap[val];
|
|
72
|
-
|
|
73
|
-
iconStr = unescape(iconStr);
|
|
74
|
-
icon.value = iconStr;
|
|
71
|
+
icon.value = String.fromCodePoint(parseInt(iconStr.replace("&#x", "").replace(";", ""), 16));
|
|
75
72
|
},
|
|
76
73
|
);
|
|
77
74
|
</script>
|
|
@@ -171,25 +171,54 @@ const buildUrl = (path: string, query?: Record<string, any>, json?: Record<strin
|
|
|
171
171
|
return params.length > 0 ? \`\${fullPath}?\${params.join('&')}\` : fullPath;
|
|
172
172
|
};
|
|
173
173
|
|
|
174
|
+
// 导航锁:修复安卓小程序下 @tap 重复触发导致的重复跳转
|
|
175
|
+
let isNavigating = false;
|
|
176
|
+
let navResetTimer: ReturnType<typeof setTimeout> | null = null;
|
|
177
|
+
|
|
178
|
+
const beginNavigate = (): boolean => {
|
|
179
|
+
if (isNavigating) return false;
|
|
180
|
+
isNavigating = true;
|
|
181
|
+
if (navResetTimer) clearTimeout(navResetTimer);
|
|
182
|
+
// 兜底:异常情况下(complete 未回调)自动释放锁
|
|
183
|
+
navResetTimer = setTimeout(() => {
|
|
184
|
+
isNavigating = false;
|
|
185
|
+
navResetTimer = null;
|
|
186
|
+
}, 1000);
|
|
187
|
+
return true;
|
|
188
|
+
};
|
|
189
|
+
|
|
190
|
+
const endNavigate = () => {
|
|
191
|
+
if (navResetTimer) {
|
|
192
|
+
clearTimeout(navResetTimer);
|
|
193
|
+
navResetTimer = null;
|
|
194
|
+
}
|
|
195
|
+
isNavigating = false;
|
|
196
|
+
};
|
|
197
|
+
|
|
174
198
|
const ToRoute: ToRouteInterface = {
|
|
175
199
|
navigate: (path, options) => {
|
|
200
|
+
if (!beginNavigate()) return;
|
|
176
201
|
const url = buildUrl(path, options?.query, options?.json);
|
|
177
|
-
uni.navigateTo({ url });
|
|
202
|
+
uni.navigateTo({ url, complete: endNavigate });
|
|
178
203
|
},
|
|
179
204
|
redirect: (path, options) => {
|
|
205
|
+
if (!beginNavigate()) return;
|
|
180
206
|
const url = buildUrl(path, options?.query, options?.json);
|
|
181
|
-
uni.redirectTo({ url });
|
|
207
|
+
uni.redirectTo({ url, complete: endNavigate });
|
|
182
208
|
},
|
|
183
209
|
switchTab: (path, options) => {
|
|
210
|
+
if (!beginNavigate()) return;
|
|
184
211
|
const url = buildUrl(path, options?.query, options?.json);
|
|
185
|
-
uni.switchTab({ url });
|
|
212
|
+
uni.switchTab({ url, complete: endNavigate });
|
|
186
213
|
},
|
|
187
214
|
reLaunch: (path, options) => {
|
|
215
|
+
if (!beginNavigate()) return;
|
|
188
216
|
const url = buildUrl(path, options?.query, options?.json);
|
|
189
|
-
uni.reLaunch({ url });
|
|
217
|
+
uni.reLaunch({ url, complete: endNavigate });
|
|
190
218
|
},
|
|
191
219
|
back: (delta = 1) => {
|
|
192
|
-
|
|
220
|
+
if (!beginNavigate()) return;
|
|
221
|
+
uni.navigateBack({ delta, complete: endNavigate });
|
|
193
222
|
}
|
|
194
223
|
};
|
|
195
224
|
|