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

STE*_*TEN 15 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'),
      // ...
    },
  },
  // ...
};
Run Code Online (Sandbox Code Playgroud)

通常情况下,就像this.$store,我可以访问localePath所提供的功能nuxt,国际化,通过应用实例或context类似this.$localePathapp.localePath。但是如何在nuxt.config.js文件内部使用它呢?

STE*_*TEN 1

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

信用@azrikahar