import Vue from 'vue'
import VueRouter from 'vue-router'
// 路由懒加载
Vue.use(VueRouter)
// const Login = () => import( '../views/login/Login')
const Home = () => import( '../views/Home.vue')
const Welcome =()=>import('../views/Welcome.vue')```
const routes = [
{ path: '/', redirect: '/home' },
// { path: '/login', component: Login },
{ path: '/home',
redirect:'/welcome',
component: Home,
children:[
{path:'/welcome',component:Welcome},
{path:'/city',component:City},
{name:"cityTitleImageEdit",path:'/cityTitleImageEdit',component:CityTitleImageEdit},
{path:'/district',component:District},
{ name:'menu',
path:'/menu',
component:Menu,
meta:{
title:'目录',
keepAlive:true,//需要缓存
isKeep:false
}
},
{name:'fileTypeEdit',path:'/fileTypeEdit',component:FileTypeEdit},
{name:'coreShow',path:'/coreShow',component:CoreShow},
{name:'contentShow',path:'/contentShow',component:ContentShow},
{name:'featureShow',path:'/featureShow',component:FeatureShow},
{name:'currentResourceImport',path:'/currentResourceImport',component:CurrentResourceImport},
{name:'editThemeShow',path:'/editThemeShow/:id',component:EditThemeShow},
{name:'Resource',path:'/resource',component:Resource},
{name:'editResource',path:'/editResource/:id',component:EditResource},
{name:'uploadResource',path:'/uploadResource/:id',component:UploadResource},
{name:'textDesc',path:'/textDesc/:id',component:TextDesc},
]
}
]
const router = new VueRouter({
routes
})
// router.beforeEach((to,from,next)=>{
// if(to.path==='/login')return next();
// const tokenStr =window.sessionStorage.getItem('token');
// if(!tokenStr) return next('/login');
// next()
// })
export default router
后台管理之router使用
最新推荐文章于 2024-06-26 17:16:33 发布