[vue] vur-router怎么重定向?
Activity
ihouchunyao commentedon Oct 23, 2019
{
path:'/goback',
redirect:'/'
}
WenJieLi1998 commentedon Apr 19, 2020
路径:{ path: '/a', redirect: '/b' }
命名的路由: { path: '/a', redirect: {name:'/foo'} }
动态重定向目标: { path: '/a', redirect: to => {
const {
query,
params,
hash
} = to
if (params.name) {
return
/${params.name}
} else if (query.to && query.to === "bar") {
return
/${query.to}
} else if (hash === '#baz') {
return '/baz'
}
}
}
lt846786463 commentedon Oct 9, 2020