-
Notifications
You must be signed in to change notification settings - Fork 11
/
main.js
44 lines (35 loc) · 1.13 KB
/
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
import Vue from 'vue'
import App from './App'
import utils from 'utils/index.js'
import cuCustom from './colorui/components/cu-custom.vue'
import store from './store'
Vue.prototype.$store = store
Vue.component('cu-custom',cuCustom)
Vue.prototype.utils = utils
Vue.config.productionTip = false
//使用微信的setData
Vue.prototype.setData = function(obj){
let that = this;
let keys = [];
let val,data;
Object.keys(obj).forEach(function(key){
keys = key.split('.');
val = obj[key];
data = that.$data;
keys.forEach(function(key2,index){
if(index+1 == keys.length){
that.$set(data,key2,val);
}else{
if(!data[key2]){
that.$set(data,key2,{});
}
}
data = data[key2];
})
});
}
App.mpType = 'app'
const app = new Vue({
...App
})
app.$mount()