¶Ô±ÈÐÂÎļþ |
| | |
| | | export default { |
| | | /** |
| | | * æ¶æ¯æç¤º |
| | | * @param content æ¶æ¯å
容 |
| | | */ |
| | | msg(content: string): void { |
| | | uni.showToast({ |
| | | title: content, |
| | | icon: 'none' |
| | | }) |
| | | }, |
| | | /** |
| | | * éè¯¯æ¶æ¯ |
| | | * @param content æ¶æ¯å
容 |
| | | */ |
| | | msgError(content: string): void { |
| | | uni.showToast({ |
| | | title: content, |
| | | icon: 'error' |
| | | }) |
| | | }, |
| | | /** |
| | | * æåæ¶æ¯ |
| | | * @param content æ¶æ¯å
容 |
| | | */ |
| | | msgSuccess(content: string): void { |
| | | uni.showToast({ |
| | | title: content, |
| | | icon: 'success' |
| | | }) |
| | | }, |
| | | /** |
| | | * éèæ¶æ¯ |
| | | */ |
| | | hideMsg(): void { |
| | | uni.hideToast() |
| | | }, |
| | | /** |
| | | * å¼¹åºæç¤º |
| | | * @param content æç¤ºå
容 |
| | | */ |
| | | alert(content: string): void { |
| | | uni.showModal({ |
| | | title: 'æç¤º', |
| | | content: content, |
| | | showCancel: false |
| | | }) |
| | | }, |
| | | /** |
| | | * 确认çªä½ |
| | | * @param content æç¤ºå
容 |
| | | * @returns |
| | | */ |
| | | confirm(content: string): Promise<unknown> { |
| | | return new Promise((resolve: Function, reject: Function) => { |
| | | uni.showModal({ |
| | | title: 'ç³»ç»æç¤º', |
| | | content: content, |
| | | cancelText: 'åæ¶', |
| | | confirmText: 'ç¡®å®', |
| | | success: function (res) { |
| | | if (res.confirm) { |
| | | resolve(res.confirm) |
| | | } |
| | | } |
| | | }) |
| | | }) |
| | | }, |
| | | /** |
| | | * æç¤ºä¿¡æ¯ |
| | | * @param option æç¤ºå
容æè
æç¤ºæ¡é
ç½® |
| | | */ |
| | | showToast(option: string | object): void { |
| | | if (typeof option === "object") { |
| | | uni.showToast(option) |
| | | } else { |
| | | uni.showToast({ |
| | | title: option, |
| | | icon: "none", |
| | | duration: 2500 |
| | | }) |
| | | } |
| | | }, |
| | | /** |
| | | * æå¼é®ç½©å±ï¼éè¦æå¨å
³éé®ç½©å± |
| | | * @param content é®ç½©å±å
容 |
| | | */ |
| | | loading(content: string): void { |
| | | uni.showLoading({ |
| | | title: content |
| | | }) |
| | | }, |
| | | /** |
| | | * å
³éé®ç½©å± |
| | | */ |
| | | closeLoading(): void { |
| | | uni.hideLoading() |
| | | } |
| | | } |