import {
createRouter,
createWebHashHistory
} from 'vue-router'
/**
* 公开路由表
*/
export const routes = [{
path: '/login',
name: 'login',
component: () => import('@/views/login/index')
}]
/**
* 这么配置页面就无法显示
*/
// export const publicRoutes = [{
// path: '/login',
// name: 'login',
// component: () => import('@/views/login/index.vue')
// }]
const router = createRouter({
history: createWebHashHistory(),
routes
// publicRoutes
})
export default router这么配置的时候是能够正常显示登陆页面的,但是如果按照视频中的配置:
import {
createRouter,
createWebHashHistory
} from 'vue-router'
/**
* 公开路由表
*/
// export const routes = [{
// path: '/login',
// name: 'login',
// component: () => import('@/views/login/index')
// }]
/**
* 这么配置页面就无法显示
*/
export const publicRoutes = [{
path: '/login',
name: 'login',
component: () => import('@/views/login/index.vue')
}]
const router = createRouter({
history: createWebHashHistory(),
// routes
publicRoutes
})
export default router登陆页面一片空白,控制台报错:
p.js:146 Uncaught TypeError: Cannot read properties of undefined (reading 'forEach') at createRouterMatcher (vue-router.mjs:1486:1) at createRouter (vue-router.mjs:2942:1) at eval (index.js:24:1) at ./src/router/index.js (app.js:59:1) at __webpack_require__ (app.js:143:33) at fn (app.js:410:21) at eval (main.js:4:65) at ./src/main.js (app.js:39:1) at __webpack_require__ (app.js:143:33) at app.js:1335:109 createRouterMatcher @ vue-router.mjs:1486 createRouter @ vue-router.mjs:2942 eval @ index.js:24 ./src/router/index.js @ app.js:59 __webpack_require__ @ app.js:143 fn @ app.js:410 eval @ main.js:4 ./src/main.js @ app.js:39 __webpack_require__ @ app.js:143 (匿名) @ app.js:1335 __webpack_require__.O @ app.js:192 (匿名) @ app.js:1336 (匿名) @ app.js:1338 crack.js:1 super_copy_cracked:false content_script.js:1 Uncaught SyntaxError: Identifier 'WBSAutoFillFormTypeUndetermined' has already been declared (at content_script.js:1:1)

基于Vue3重写Vue-element-admin,打造后台前端综合解决方案
了解课程