import Vue from 'vue'
|
import App from './App.vue'
|
import router from './router'
|
import store from './store'
|
import './assets/css/common.css'
|
import './assets/iconfont/iconfont.css'
|
|
Vue.config.productionTip = false
|
|
|
const setHtmlFontSize = () => {
|
const htmlDom = document.getElementsByTagName('html')[0];
|
let htmlWidth = document.documentElement.clientWidth || document.body.clientWidth;
|
if (htmlWidth >= 750) {
|
htmlWidth = 750;
|
}
|
if (htmlWidth <= 320) {
|
htmlWidth = 320;
|
}
|
htmlDom.style.fontSize = `${htmlWidth / 7.5}px`;
|
};
|
|
// 进入路由前
|
router.beforeEach((to, from, next) => {
|
// 修改主导航的激活状态
|
store.dispatch('changeNavName', to.name);
|
// 修改面包屑导航内容
|
store.dispatch('changeCrumb', to.meta.crumb);
|
next();
|
});
|
|
window.onresize = setHtmlFontSize;
|
|
setHtmlFontSize();
|
|
new Vue({
|
router,
|
store,
|
render: h => h(App),
|
}).$mount('#app')
|