08335 / hivui-platform-template
hivui平台项目模板
Newer
Older
hivui-platform-template / project / hivuiMain / permission.js
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=="/"||to.path.indexOf("tabUrl=")!=-1){
        store.dispatch('initApp').then(i=>{
            store.dispatch('setAppLoad','success');
            // console.log('//初始化成功!')
            next();
        }).catch(e=>{
            store.dispatch('setAppLoad','failed');
        });
    }else{
        store.dispatch('setAppLoad','success');
        next();
    }
});
router.afterEach((to,form)=>{
    // location.hash = location.hash.replace(/(#\/){1,}/gi,"#/");
    // console.log('-----------------router.afterEach---------------',new Date(),location.hash );
});