54 lines
962 B
JavaScript
54 lines
962 B
JavaScript
import Vue from 'vue'
|
|
import Vuex from 'vuex'
|
|
import App from './App.vue'
|
|
import router from './router'
|
|
import ElementUI from 'element-ui';
|
|
import 'element-ui/lib/theme-chalk/index.css';
|
|
import 'element-ui/lib/theme-chalk/display.css';
|
|
import VueMeta from 'vue-meta'
|
|
|
|
//要添加的代码
|
|
router.beforeEach((to, from, next) => {
|
|
// chrome
|
|
document.body.scrollTop = 0
|
|
// firefox
|
|
document.documentElement.scrollTop = 0
|
|
// safari
|
|
window.pageYOffset = 0
|
|
next()
|
|
})
|
|
|
|
Vue.config.productionTip = false
|
|
Vue.use(ElementUI)
|
|
Vue.use(VueMeta)
|
|
Vue.use(Vuex)
|
|
const store = new Vuex.Store({
|
|
state: {
|
|
isEnglish: false,
|
|
menuList :{},
|
|
},
|
|
mutations: {
|
|
increment (state) {
|
|
state.count++
|
|
}
|
|
},
|
|
computed:{
|
|
setEnglish(isEnglish){
|
|
this.store.isEnglish = isEnglish
|
|
},
|
|
},
|
|
getters:{
|
|
getEnglish(){
|
|
return this.store.isEnglish
|
|
}
|
|
}
|
|
})
|
|
|
|
|
|
|
|
new Vue({
|
|
router,
|
|
store: store,
|
|
render: h => h(App)
|
|
}).$mount('#app')
|