forked from fxueye/taobaoke
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.js
More file actions
72 lines (66 loc) · 1.39 KB
/
main.js
File metadata and controls
72 lines (66 loc) · 1.39 KB
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
62
63
64
65
66
67
68
69
70
71
72
import Vue from 'vue'
import App from './App'
import store from './store'
import config from './common/config'
import {
checkVersion
} from './common/api'
Vue.config.productionTip = false
Vue.prototype.$store = store
Vue.prototype.$config = config
Vue.prototype.checkVersion = function() {
return new Promise((resolve, reject) => {
try {
let channel = config.channel;
let versionCode = config.versionCode;
// #ifdef APP-PLUS
checkVersion({
channel: channel,
version_code: versionCode
}).then(response => {
if (response.data.app) {
let app = response.data.app;
if (app.flag == 1) {
uni.showModal({
title: '更新提示',
content: app.msg,
success: (res) => {
if (res.confirm) {
plus.runtime.openURL(app.down_url);
}
}
})
}
resolve()
} else {
reject()
}
}).catch(error => {
reject(error)
})
// #endif
// reject()
} catch (e) {
reject(e)
}
});
}
Vue.prototype.disabledPullRefresh = function(disabled) {
// #ifdef APP-PLUS
const pages = getCurrentPages();
const page = pages[pages.length - 1];
const currentWebview = page.$getAppWebview();
currentWebview.setStyle({
pullToRefresh: {
support: disabled,
style: plus.os.name === 'Android' ? 'circle' : 'default'
}
})
// #endif
}
App.mpType = 'app'
const app = new Vue({
store,
...App
})
app.$mount()