fix: 解决vue route warn not found

This commit is contained in:
caoqianming 2025-02-08 18:50:30 +08:00
parent 4dddbce330
commit 92302c061d
2 changed files with 5 additions and 6 deletions

View File

@ -12,11 +12,6 @@ import { beforeEach, afterEach } from './scrollBehavior';
const routes = systemRouter const routes = systemRouter
//系统特殊路由 //系统特殊路由
const routes_404 = {
path: "/:pathMatch(.*)*",
hidden: true,
component: () => import(/* webpackChunkName: "404" */ '@/layout/other/404'),
}
let routes_404_r = () => { } let routes_404_r = () => { }
const router = createRouter({ const router = createRouter({
@ -76,7 +71,6 @@ router.beforeEach(async (to, from, next) => {
menuRouter.forEach(item => { menuRouter.forEach(item => {
router.addRoute("layout", item) router.addRoute("layout", item)
}); });
routes_404_r = router.addRoute(routes_404);
if (to.matched.length == 0) { if (to.matched.length == 0) {
router.push(to.fullPath); router.push(to.fullPath);
} }

View File

@ -16,6 +16,11 @@ const routes = [
title: "登录" title: "登录"
} }
}, },
{
path: "/:pathMatch(.*)*",
hidden: true,
component: () => import(/* webpackChunkName: "404" */ '@/layout/other/404'),
},
{ {
path: "/user_register", path: "/user_register",
component: () => import(/* webpackChunkName: "userRegister" */ '@/views/login/userRegister'), component: () => import(/* webpackChunkName: "userRegister" */ '@/views/login/userRegister'),