功能完善
This commit is contained in:
@@ -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);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user