簡體   English   中英

我可以在 nuxt.config.js 中訪問 nuxt 上下文嗎?

[英]Can I access nuxt context in nuxt.config.js?

我正在使用nuxt-i18n@nuxtjs/auth ,我想配置auth.redirect選項來支持 i18n,如下所示:

// nuxt.config.js

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

通常情況下,就像this.$store ,我可以訪問localePath所提供的功能nuxt,國際化,通過應用實例或contextthis.$localePathapp.localePath 但是如何在nuxt.config.js文件中使用它呢?

對於具有 i18n 重定向支持問題的 @nuxt/auth 模塊,我找到了一種解決方法: https : //github.com/nuxt-community/auth-module/issues/1116#issuecomment-824814739

信用@azrikahar

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM