Vue router中alias和redirect的区别

2019-04-29  本文已影响0人  Gino_Li

redirect

<router-link to="/home"></router-link>
                {
                    path:'/home',
                    name:'home',
                    component:()=>import('@/components/a.vue'),
                    redirect:'/index' //重定向
                }

点击进入后显示的url

localhost:8080/#/index

显示的是重定向后的地址即index

alias

        {
            path:'/home',
            component:Home,
            name:'home',
            alias:"/h",   //别名
        }

点击进入后显示的url

localhost:8080/#/h

显示的是别名h

总结

上一篇 下一篇

猜你喜欢

热点阅读