Browse Source

fix: Resolve Vue Router error caused by duplicate route names (#6994)

thin
王少腾 2 months ago
committed by GitHub
parent
commit
840def74a9
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 2
      src/router/constant.ts
  2. 10
      src/router/routes/basic.ts

2
src/router/constant.ts

@ -4,6 +4,8 @@ export const PARENT_LAYOUT_NAME = 'ParentLayout'
export const PAGE_NOT_FOUND_NAME = 'PageNotFound'
export const PAGE_NOT_FOUND_MATCH_NAME = 'PageNotFoundMatch'
export const EXCEPTION_COMPONENT = () => import('/@/views/sys/exception/Exception.vue')
/**

10
src/router/routes/basic.ts

@ -1,5 +1,11 @@
import type { AppRouteRecordRaw } from '/@/router/types'
import { REDIRECT_NAME, LAYOUT, EXCEPTION_COMPONENT, PAGE_NOT_FOUND_NAME } from '/@/router/constant'
import {
REDIRECT_NAME,
LAYOUT,
EXCEPTION_COMPONENT,
PAGE_NOT_FOUND_NAME,
PAGE_NOT_FOUND_MATCH_NAME,
} from '/@/router/constant'
// 404 on a page
export const PAGE_NOT_FOUND_ROUTE: AppRouteRecordRaw = {
@ -14,7 +20,7 @@ export const PAGE_NOT_FOUND_ROUTE: AppRouteRecordRaw = {
children: [
{
path: '/:path(.*)*',
name: PAGE_NOT_FOUND_NAME,
name: PAGE_NOT_FOUND_MATCH_NAME,
component: EXCEPTION_COMPONENT,
meta: {
title: 'ErrorPage',

Loading…
Cancel
Save