1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
| /**
| * 数据加载弹窗
| * 根据加载状态,展示对应的弹窗
| * @see './b_loadingStatus.js'
| */
| module.exports = Behavior({
| data: {
| loadingText: '加载中',
| loadCompleteText: '加载完成',
| timeoutText: '加载超时'
| },
| methods: {
| // 加载开始toast
| loadStart() {
| wx.showLoading({
| title: this.data.loadingText,
| mask: true,
| })
| },
| // 加载中toast
| loading() {
|
| },
| // 加载完成toast
| loadComplete() {
| wx.hideLoading({
| success: (res) => {
| wx.showToast({
| title: this.data.timeout ? this.data.timeoutText : this.data.loadCompleteText,
| duration: 1000,
| icon: this.data.timeout ? 'error' : 'success',
| mask: true,
| })
| },
| })
| },
| }
| })
|
|