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 );
});
