diff --git a/apps/backend-mock/utils/mock-data.ts b/apps/backend-mock/utils/mock-data.ts index 84c416de..32d3a5d0 100644 --- a/apps/backend-mock/utils/mock-data.ts +++ b/apps/backend-mock/utils/mock-data.ts @@ -194,18 +194,46 @@ export const MOCK_MENUS = [ export const MOCK_MENU_LIST = [ { id: 1, - name: 'Workspace', + name: 'Dashboard', status: 1, - type: 'menu', - icon: 'mdi:dashboard', - path: '/workspace', - component: '/dashboard/workspace/index', + type: 'catalog', + icon: 'lucide:layout-dashboard', + path: '/dashboard', meta: { - icon: 'carbon:workspace', - title: 'page.dashboard.workspace', - affixTab: true, - order: 0, + icon: 'lucide:layout-dashboard', + order: -1, + title: 'page.dashboard.title', }, + children: [ + { + id: 101, + pid: 1, + status: 1, + type: 'menu', + name: 'Analytics', + path: 'analytics', + component: '/dashboard/analytics/index', + meta: { + affixTab: true, + icon: 'lucide:area-chart', + title: 'page.dashboard.analytics', + keepAlive: true, + }, + }, + { + id: 102, + pid: 1, + status: 1, + type: 'menu', + name: 'Workspace', + path: 'workspace', + component: '/views/dashboard/workspace/index', + meta: { + icon: 'carbon:workspace', + title: 'page.dashboard.workspace', + }, + }, + ], }, { id: 2, diff --git a/docs/src/en/guide/in-depth/access.md b/docs/src/en/guide/in-depth/access.md index 545dddab..72aa272d 100644 --- a/docs/src/en/guide/in-depth/access.md +++ b/docs/src/en/guide/in-depth/access.md @@ -122,12 +122,12 @@ const dashboardMenus = [ title: 'page.dashboard.title', }, name: 'Dashboard', - path: '/', - redirect: '/analytics', + path: '/dashboard', + redirect: '/dashboard/analytics', children: [ { name: 'Analytics', - path: '/analytics', + path: 'analytics', // Here is the path of the page, need to remove 'views/' and '.vue' component: '/dashboard/analytics/index', meta: { @@ -137,7 +137,7 @@ const dashboardMenus = [ }, { name: 'Workspace', - path: '/workspace', + path: 'workspace', component: '/dashboard/workspace/index', meta: { title: 'page.dashboard.workspace', diff --git a/docs/src/guide/in-depth/access.md b/docs/src/guide/in-depth/access.md index bbce30a2..5de49b2a 100644 --- a/docs/src/guide/in-depth/access.md +++ b/docs/src/guide/in-depth/access.md @@ -120,12 +120,12 @@ const dashboardMenus = [ title: 'page.dashboard.title', }, name: 'Dashboard', - path: '/', - redirect: '/analytics', + path: '/dashboard', + redirect: '/dashboard/analytics', children: [ { name: 'Analytics', - path: '/analytics', + path: 'analytics', // 这里为页面的路径,需要去掉 views/ 和 .vue component: '/dashboard/analytics/index', meta: { @@ -135,7 +135,7 @@ const dashboardMenus = [ }, { name: 'Workspace', - path: '/workspace', + path: 'workspace', component: '/dashboard/workspace/index', meta: { title: 'page.dashboard.workspace', diff --git a/playground/src/views/system/menu/modules/form.vue b/playground/src/views/system/menu/modules/form.vue index 815c4c14..7029db00 100644 --- a/playground/src/views/system/menu/modules/form.vue +++ b/playground/src/views/system/menu/modules/form.vue @@ -88,7 +88,13 @@ const schema: VbenFormSchema[] = [ label: $t('system.menu.parent'), renderComponentContent() { return { - title({ label, meta }: { label: string; meta: Recordable }) { + treeTitleRender({ + label, + meta, + }: { + label: string; + meta: Recordable; + }) { const coms = []; if (!label) return ''; if (meta?.icon) { @@ -129,12 +135,6 @@ const schema: VbenFormSchema[] = [ .string() .min(2, $t('ui.formRules.minLength', [$t('system.menu.path'), 2])) .max(100, $t('ui.formRules.maxLength', [$t('system.menu.path'), 100])) - .refine( - (value: string) => { - return value.startsWith('/'); - }, - $t('ui.formRules.startWith', [$t('system.menu.path'), '/']), - ) .refine( async (value: string) => { return !(await isMenuPathExists(value, formData.value?.id)); @@ -162,12 +162,6 @@ const schema: VbenFormSchema[] = [ .string() .min(2, $t('ui.formRules.minLength', [$t('system.menu.path'), 2])) .max(100, $t('ui.formRules.maxLength', [$t('system.menu.path'), 100])) - .refine( - (value: string) => { - return value.startsWith('/'); - }, - $t('ui.formRules.startWith', [$t('system.menu.path'), '/']), - ) .refine(async (value: string) => { return await isMenuPathExists(value, formData.value?.id); }, $t('system.menu.activePathMustExist'))