我可以在nuxt.config.js中访问nuxt上下文吗?

时间:2020-03-31 15:07:16

标签: javascript vue.js nuxt.js nuxt-i18n

我正在使用nuxt-i18n@nuxtjs/auth,并且想要配置auth.redirect选项以支持i18n,如下所示:

// nuxt.config.js

export default {
  modules: [
    '@nuxtjs/auth',
    'nuxt-i18n',
    // ...
  ],
  auth: {
    redirect: {
      home: localePath('/dashboard'),
      // ...
    },
  },
  // ...
};

通常,就像this.$store一样,我可以通过应用实例访问nuxt-i18n提供的localePath函数,也可以像context或{{1 }}。但是如何在this.$localePath文件中使用它?

1 个答案:

答案 0 :(得分:1)

如果@nuxt/auth 模块存在 i18n 重定向支持问题,我找到了一个解决方法:https://github.com/nuxt-community/auth-module/issues/1116#issuecomment-824814739

信用@azrikahar