我想一起使用 nuxt@auth 模块和 nuxt-i18n。当我想为登录页面设置不同的路由时,就会出现问题。例如:
pages: {
login: {
en: '/authorization',
fr: '/autorisation'
}
}
路由运行良好,但是当我尝试在所有页面受限的情况下使用 nuxt@auth 时,默认重定向要求访问/login 页面。在 nuxt.config.js 文件中,我可以重写重定向路由,但我只能设置一个重定向。
auth: {
redirect: {
login: '/fr/autorisation'
}
}
如何向授权模块显示以请求所选语言的路由?提前致谢!
最佳答案
希望对大家有帮助 =)
export default ({ app, $auth }) => {
$auth.onRedirect((to, from) => {
return app.localePath(to)
})
}
关于javascript - 如何让 Nuxt-auth 和 Nuxt-i18n 成为 friend ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52364451/