-
Notifications
You must be signed in to change notification settings - Fork 25
/
Copy pathmain.js
43 lines (39 loc) · 912 Bytes
/
main.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
import Vue from 'vue'
import App from './App'
const request = (params = {}) => {
return new Promise((resolve, reject) => {
uni.showLoading({
title: params.loadText || 'Loading',
mask: true
})
uni.request({
url: params.url,
method: params.method,
data: {
...params.data
},
header: {
'Content-Type': 'application/json; charset=UTF-8'
},
timeout: 5000,
success: (res) => {
resolve(res.data)
},
fail: (err) => {
reject(err)
},
complete: () => {
uni.hideLoading()
}
})
})
}
Vue.config.productionTip = false
Vue.prototype.$api = {
request
};
App.mpType = 'app'
const app = new Vue({
...App
})
app.$mount()