Skip to content

Commit

Permalink
fix(projects): fix old routeConst
Browse files Browse the repository at this point in the history
  • Loading branch information
honghuangdc committed Sep 8, 2023
1 parent 253bf15 commit 1570084
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 11 deletions.
9 changes: 1 addition & 8 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
{
"cSpell.words": [
"consola",
"iife",
"kolorist",
"magicast",
"tsup",
"unplugin"
],
"cSpell.words": ["consola", "iife", "kolorist", "magicast", "tsup", "unplugin"],
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
},
Expand Down
1 change: 1 addition & 0 deletions examples/template-vue/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"name": "template-vue",
"version": "0.2.1",
"private": true,
"type": "module",
"scripts": {
"dev": "vite",
"debug": "vite --debug",
Expand Down
2 changes: 1 addition & 1 deletion examples/template-vue/src/router/elegant/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import type { ElegantRoute } from '@elegant-router/types';
export const autoRoutes: ElegantRoute[] = [
{
path: '/403',
component: 'layout.blank',
component: 'layout.base',
children: [
{
name: '403',
Expand Down
2 changes: 1 addition & 1 deletion examples/template-vue/src/router/routes/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const constantRoutes: CustomRoute[] = [
},
{
path: '/:pathMatch(.*)*',
component: 'layout.default',
component: 'layout.base',
children: [
{
name: 'not-found',
Expand Down
4 changes: 3 additions & 1 deletion packages/vue/src/context/const.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ async function getConstCode(trees: ElegantRouterTree[], options: ElegantVueRoute

const autoRoutes = trees.map(item => transformRouteTreeToRouteRecordRaw(item, options));

const updated = getUpdatedRouteConst(md.exports.autoRoutes as AutoRoute[], autoRoutes, options);
const oldRoutes = JSON.parse(JSON.stringify(md.exports.autoRoutes)) as AutoRoute[];

const updated = getUpdatedRouteConst(oldRoutes, autoRoutes, options);

md.exports.autoRoutes = updated as any;

Expand Down

0 comments on commit 1570084

Please sign in to comment.