/
main.js
executable file
·84 lines (76 loc) · 1.87 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
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
import Vue from "vue";
import App from "./App.vue";
import router from "./router";
import store from "./store";
import i18n from "./lang";
import axios from "./assets/js/axios";
import VueTouch from "vue-touch";
import VueLazyLoad from "vue-lazyload";
import Vconsole from "vconsole";
import fastclick from "fastclick";
import Raven from "raven-js";
import RavenVue from "raven-js/plugins/vue";
import { mapGetters, mapMutations } from "vuex";
// import "../public/js/rem.js";
// 控制台插件
let vConsole = null;
process.env.NODE_ENV == "development" && (vConsole = new Vconsole());
export default vConsole;
// axios全局拦截
Vue.prototype.$http = axios;
// mock模拟数据
require("../mock");
// 去除移动端点击200ms延迟
fastclick.attach(document.body);
// Sentry错误日志监控
Raven.config("https://ce431a99e0884612a053541eef0f2810@sentry.io/1245961", {
release: process.env.RELEASE_VERSION,
debug: true
})
.addPlugin(RavenVue, Vue)
.install();
// 图片懒加载
Vue.use(VueLazyLoad, {
//懒加载声明错误图和占位图
preLoad: 1.3,
error: "./img/github.png",
loading: "./img/github.png"
});
// 手势滑动事件
Vue.use(VueTouch, {
name: "v-touch"
});
VueTouch.config.swipe = {
direction: "horizontal",
threshold: 200
};
Vue.config.productionTip = false;
Vue.mixin({
data() {
return {
cartLength: 0,
slidename: "slide-go",
mainarea: false
};
},
mounted() {
this.mainarea = true;
},
computed: {
...mapGetters(["this.$store.state.comname"])
},
methods: {
...mapMutations({
setGoods: "SET_GOODS",
setCarts: "SET_CARTS",
setTabindex: "SET_TABINDEX",
setComname: "SET_COMNAME"
})
}
});
new Vue({
router,
store,
i18n,
render: h => h(App)
}).$mount("#app");