功能完善

This commit is contained in:
2024-04-13 17:20:09 +08:00
parent be328f9243
commit 23af4c25e3
15 changed files with 253 additions and 90 deletions

View File

@@ -1,4 +1,5 @@
// 小程序更新检测
export function mpUpdate() {
const updateManager = uni.getUpdateManager();
updateManager.onCheckForUpdate((res) => {
@@ -27,11 +28,25 @@ export function mpUpdate() {
});
}
export function showToast(title: string, icon: 'none' | 'success' | 'loading' | 'error' | 'fail' | 'exception' | undefined = 'none', duration: number = 2000) {
interface ToastOption {
icon?: 'none' | 'success' | 'loading' | 'error' | 'fail' | 'exception' | undefined,
duration?: number,
complete?: Function
}
export function showToast(title: string, { icon, duration, complete }: ToastOption = {}) {
const defaultDuration = 1500;
uni.showToast({
title,
icon,
duration
title: title,
icon: icon || 'none',
duration: duration || defaultDuration,
complete(result) {
setTimeout(() => {
if(complete != undefined) {
complete();
}
}, duration || defaultDuration);
}
});
}