1.路由懒加载 webpack的require.ensure被import代替 import(/* webpackChunkName: "App" */'./App'), 注释里的是打包后的名字
2. //可以只在home.vue里写 主路由获取一次loginfo就行 routereach还可以用在防止用户直接输入跳转详情页来控制from
router.beforeEach((to, from, next) => {
iView.LoadingBar.start();
let token = system.getCookie('token');
if(token){
Vue.prototype.$token=token;
}
if (token && to.name != 'login') {
getLoginInfo([token]).then(info=>{
if (info.user.group&&info.user.group == 1) {
next();
}else{
iView.Message.info('没有权限');
system.deleteCookie('token');
next('/login');
iView.LoadingBar.finish();