重定向和别名

new router({

  routes:[

    {

      path: '/',

      conponent: home,

      name: 'Home',

      alias: '/index'

    },{

      path: '/about',

      conponent: about,

      name: 'About', 

    },{

      path: '/document',

      conponent: document,

      name: 'Document', 

    },{

      path: '*',

      // redirect: home  组件方式重定向

      // redirect: 'Home'   别名方式重定向

      // redirect: '/'

      //redirect (to) =>{
        if(to.path==='/123'){

          to.path='/'

         }else{

          to.path='/about'

          }
      }  

    },

  ]

})

转载于:https://www.cnblogs.com/jessicaWy/p/7253230.html

你可能感兴趣的:(重定向和别名)