后台管理之router使用

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
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值