fix: page menu sort

This commit is contained in:
chenos 2020-12-16 08:43:09 +08:00
parent 866549ce26
commit 50a081c861
2 changed files with 5 additions and 4 deletions

View File

@ -12,7 +12,7 @@ function pages2routes(pages: Array<any>) {
}; };
// page.type === 'layout' && // page.type === 'layout' &&
if (!page.redirect && children.length) { 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; route.redirect = items[0].path;
} }
if (page.type === 'layout' && children.length) { if (page.type === 'layout' && children.length) {
@ -20,7 +20,7 @@ function pages2routes(pages: Array<any>) {
...child, ...child,
title: child.title, title: child.title,
path: child.path, path: child.path,
order: child.order, sort: child.sort,
})); }));
} }
if (page.children) { if (page.children) {

View File

@ -3,14 +3,15 @@ import { TableOptions } from '@nocobase/database';
export default { export default {
name: 'pages', name: 'pages',
title: '页面配置', title: '页面配置',
model: 'BaseModel', model: 'PageModel',
internal: true, internal: true,
developerMode: true, developerMode: true,
fields: [ fields: [
{ {
interface: 'sort', interface: 'sort',
type: 'integer', type: 'sort',
name: 'sort', name: 'sort',
scope: ['parent_id'],
title: '排序', title: '排序',
component: { component: {
type: 'sort', type: 'sort',