在nuxt extendRoutes中使用重定向功能

时间:2019-12-17 01:46:57

标签: vue.js redirect routing vue-router nuxt

我正在尝试使用函数而不是字符串来重定向nuxt ExtendedRoutes参数内部。我似乎有一些问题。我可以在vue开发工具中看到它,但是重定向显示为未定义。我的语法有问题吗?这就是在vue-router中的工作方式,因此我认为这与nuxt一样。

nuxt.config.js

{
  router: {
    extendRoutes (routes) {

      // This redirect works
      routes.push({
        path: '/team-finder',
        redirect: '/team-finder/teams'
      })


      // This does not work at all
      routes.push({
        path: '/team-finder-redirect',
        redirect: to => '/team-finder/teams'
      })
    }
  }
}

0 个答案:

没有答案