兼兼街租房小程序
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

50 lines
1.0 KiB

import Vue from 'vue';
import App from './App';
import request from '@/common/axios.js';
import tokenUtil from '@/common/token.js';
Vue.config.productionTip = false;
Vue.prototype.$request = request;
Vue.prototype.$tokenUtil = tokenUtil;
Vue.prototype.$token = tokenUtil.token;
Vue.prototype.$user = tokenUtil.user;
/* 导入接口 */
let api = require('./common/api');
Vue.prototype.$api = api;
// 方法
import functions from './common/functions.js'
Vue.prototype.$functions = functions
Vue.mixin({
methods: {
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();