路由认证
router.beforeEach((to,from,next)=>{
if(to.name=="index"){
if(localStorage.getItem("eleToken")){
next();
}else{
next({
path:"/login",
query:{redirect:to.fullPath}
})
}
}else{
next();
}
})