import router from './router' import store from './store' router.beforeEach((to, from, next) => { if(to.meta.title){ document.title=to.meta.title; } if(to.path!="/"){ store.dispatch('setAppLoad','success'); next(); }else{ store.dispatch('initApp').then(i=>{ store.dispatch('setAppLoad','success'); // console.log('//初始化成功!') next(); }).catch(e=>{ store.dispatch('setAppLoad','failed'); }); } }); router.afterEach((to,form)=>{ // location.hash = location.hash.replace(/(#\/){1,}/gi,"#/"); // console.log('-----------------router.afterEach---------------',new Date(),location.hash ); });