From 50a081c86151f0d4feb2e53cf4a9813592036a99 Mon Sep 17 00:00:00 2001 From: chenos Date: Wed, 16 Dec 2020 08:43:09 +0800 Subject: [PATCH] fix: page menu sort --- packages/plugin-pages/src/actions/getRoutes.ts | 4 ++-- packages/plugin-pages/src/collections/pages.ts | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/packages/plugin-pages/src/actions/getRoutes.ts b/packages/plugin-pages/src/actions/getRoutes.ts index 21be91a216..8b9bbdc611 100644 --- a/packages/plugin-pages/src/actions/getRoutes.ts +++ b/packages/plugin-pages/src/actions/getRoutes.ts @@ -12,7 +12,7 @@ function pages2routes(pages: Array) { }; // page.type === 'layout' && if (!page.redirect && children.length) { - const items = children.sort((a, b) => a.order - b.order); + const items = children.sort((a, b) => a.sort - b.sort); route.redirect = items[0].path; } if (page.type === 'layout' && children.length) { @@ -20,7 +20,7 @@ function pages2routes(pages: Array) { ...child, title: child.title, path: child.path, - order: child.order, + sort: child.sort, })); } if (page.children) { diff --git a/packages/plugin-pages/src/collections/pages.ts b/packages/plugin-pages/src/collections/pages.ts index 5889776180..1b383167b5 100644 --- a/packages/plugin-pages/src/collections/pages.ts +++ b/packages/plugin-pages/src/collections/pages.ts @@ -3,14 +3,15 @@ import { TableOptions } from '@nocobase/database'; export default { name: 'pages', title: '页面配置', - model: 'BaseModel', + model: 'PageModel', internal: true, developerMode: true, fields: [ { interface: 'sort', - type: 'integer', + type: 'sort', name: 'sort', + scope: ['parent_id'], title: '排序', component: { type: 'sort',