whychdw
2020-11-21 4fe077b7d5393e9b53553e417ce68ea5e293857c
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
import Vue from 'vue'
import App from './App.vue'
import router from './router'
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
// import './assets/css/m-elementui.css'
// import "./assets/css/theme/science-blue.css"
import './components'
// import './assets/css/basic.css'
// import './assets/css/common.css'
import './assets/js/unCtrl'
 
import G from './global'
 
import layer from 'vue-layer'
import 'vue-layer/lib/vue-layer.css';
 
import './assets/iconfont/iconfont.css';
 
// jsonp请求方式  请求tx地图接口  
import VueJsonp from 'vue-jsonp'
import axios from './assets/js/axios'
 
import apis from './assets/js/apis'
Vue.use(VueJsonp)
 
Vue.prototype.$layer = layer(Vue);
 
Vue.use(ElementUI, {
    zIndex: 99
});
 
Vue.config.productionTip = false
 
Vue.prototype.$G = G;
Vue.prototype.$axios = axios;
Vue.prototype.$apis = apis;
 
// 引入vuex
import store from './store'
 
//格式化时间
Date.prototype.format = function(format) {
    var o = {
        "M+": this.getMonth() + 1, //month
        "d+": this.getDate(), //day
        "h+": this.getHours(), //hour
        "m+": this.getMinutes(), //minute
        "s+": this.getSeconds(), //second
        "q+": Math.floor((this.getMonth() + 3) / 3), //quarter
        "S": this.getMilliseconds() //millisecond
    };
    if (/(y+)/.test(format)) format = format.replace(RegExp.$1,
        (this.getFullYear() + "").substr(4 - RegExp.$1.length));
    for (var k in o)
        if (new RegExp("(" + k + ")").test(format))
            format = format.replace(RegExp.$1,
                RegExp.$1.length == 1 ? o[k] :
                ("00" + o[k]).substr(("" + o[k]).length));
    return format;
};
 
// 对toFixed数字保留位数二次封装(ps:toFixed返回的是字符串)
Number.prototype.toHold = function(value) {
    var hold = this.toFixed(value);
    hold = Number(hold);
    return hold;
};
 
/**
 * @注册一个全局方法储存skin方法
 * @author (zyk)
 * @param { string } key 键
 * @param { string } data 要存储的数据
 * @returns 
 */
Vue.prototype.$addSkinStorageEvent = function(key, data) {
    // 创建一个StorageEvent事件
    var newStorageEvent = document.createEvent('StorageEvent');
    const storage = {
        setItem: function(k, val) {
            localStorage.setItem(k, val);
            // 初始化创建的事件
            newStorageEvent.initStorageEvent('setSkinItem', false, false, k, null, val, null, null);
            // 派发对象
            window.dispatchEvent(newStorageEvent);
        }
    }
    return storage.setItem(key, data);
}
 
 
new Vue({
    router,
    store,
    render: h => h(App),
}).$mount('#app')