0
点赞
收藏
分享

微信扫一扫

实现首页路由的重定向效果

千白莫 2022-04-15 阅读 63
vue前端

① 新建一个 Welcome.vue

② 在 router 中进行导入

使用 redirect 进行重定向

import Welcome from '@/components/Welcome'

Vue.use(VueRouter)

const routes = [
  {path: '/',redirect:'/login'},
  {path:'/login',component:Login},
  {path:'/home',
    component:Home,
    redirect: '/weclome',
    children: [
      { path: '/weclome', component:Welcome }
    ]},
]

const router = new VueRouter({
  routes
})
举报

相关推荐

0 条评论