点是我决定删除登录页,这是内页"/login"。因为我想改个名字把它放在一个名为auth"的文件夹下保持一个更好的档案秩序。我删除了nuxt文件夹,我再次运行dev命令重建,但我注意到我仍然被重定向到/login页面,我确实搜索了即将到来的地方,并最终在nuxt内部的auth.js有一个配置重定向仍然指向/login,所以无论我删除多少次文件夹。nuxt仍然重新出现,即使页面不再存在。
我还做了:
- 从next .config.js中完全删除中间件配置 删除中间件文件夹
- 再次删除。next文件夹
但我仍然会在auth.js文件中有这个配置
export default function (ctx, inject) {
// Options
const options = {
"resetOnError": false,
"ignoreExceptions": false,
"scopeKey": "scope",
"rewriteRedirects": true,
"fullPathRedirect": false,
"watchLoggedIn": true,
"redirect": {
"login": "/login",
"logout": "/",
"home": "/",
"callback": "/login"
},
"vuex": {
"namespace": "auth"
},
"cookie": {
"prefix": "auth.",
"options": {
"path": "/"
}
},
"localStorage": {
"prefix": "auth."
},
"defaultStrategy": ""
}
有什么解决办法吗?这是一种bug,还是我遗漏了什么?
**** UPDATE next .config.js ******
export default {
target: 'static',
head: {
title: 'test',
htmlAttrs: {
lang: 'en'
},
meta: [
{ charset: 'utf-8' },
{ name: 'viewport', content: 'width=device-width, initial-scale=1' },
{ hid: 'description', name: 'description', content: '' },
{ name: 'format-detection', content: 'telephone=no' }
],
link: [
{ rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }
]
},
css: [
'~/assets/css/font.css',
'~/assets/css/base.css',
'~/assets/css/forms.css'
],
plugins: [
'~/plugins/vee-validate.js'
],
components: true,
buildModules: [
],
modules: [
'@nuxtjs/axios',
'@nuxtjs/auth-next',
'@nuxtjs/firebase',
],
firebase:{
config: {
apiKey: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
authDomain: "nxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
projectId: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
storageBucket: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
messagingSenderId: "xxxxxxxxxxxxx",
appId: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
},
services: {
auth: {
persistence: 'local',
initialize: {
onAuthStateChangedAction: 'authentication/onAuthStateChangedAction',
subscribeManually: false
},
ssr: false,
}
}
},
axios:{
baseUrl: 'http://localhost:3000/'
},
auth: {
},
router:{
},
build: {
transpile: ['vee-validate']
}
}
OP在删除一些旧的nuxt/auth
配置时遇到了麻烦,通过删除nuxt.config.js
中的auth
密钥,路由器和清洁.nuxt
,然后解决了问题!