-
Notifications
You must be signed in to change notification settings - Fork 0
/
mixin.js
61 lines (60 loc) · 1.04 KB
/
mixin.js
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
import {
ui
} from '@/utils'
export default {
methods: {
goBack(delta = 1, isRefresh) {
if (isRefresh) {
let app = getApp();
app.globalData.refreshNext = true
}
return new Promise((resolve, reject) => {
uni.navigateBack({
delta: delta,
success() {
resolve()
},
fail(error) {
uni.switchTab({
url: url,
});
}
})
})
},
goto(url, params, isRedirect = false) {
url = ui.dealUrl(url, params)
return new Promise(function(resolve, reject) {
if (!isRedirect) {
uni.navigateTo({
url: url,
success: function success() {
resolve();
},
fail: function fail(error) {
uni.switchTab({
url: url,
success() {},
fail() {}
});
}
});
} else {
uni.redirectTo({
url: url,
success: function success() {
resolve();
},
fail: function fail() {
uni.switchTab({
url: url,
success() {},
fail() {}
});
}
});
}
});
}
}
}