开发者社区 问答 正文

vur-router怎么重定向?

[vue] vur-router怎么重定向?

展开
收起
游客7iokfgo4yexey 2020-05-23 20:58:52 897 分享 版权
1 条回答
写回答
取消 提交回答
  • 路径:{ 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' } } } 问题来源于GitHub,查看更多答案,请查看https://github.com/haizlin/fe-interview/issues/376

    2020-05-24 12:02:31
    赞同 展开评论
问答地址: