diff --git a/src/types/api/system/menu.d.ts b/src/types/api/system/menu.d.ts index 34dedbc6..032e73b9 100644 --- a/src/types/api/system/menu.d.ts +++ b/src/types/api/system/menu.d.ts @@ -30,7 +30,7 @@ export interface MenuFormData { /** * 菜单ID */ - id: string , + id?: string , /** * 父菜单ID */ @@ -51,7 +51,7 @@ export interface MenuFormData { /** * 组件路径 */ - component: string, + component?: string, /** * 路由路径 */ diff --git a/src/views/system/menu/components/Menu.vue b/src/views/system/menu/components/Menu.vue index ddac90cd..f724ad2d 100644 --- a/src/views/system/menu/components/Menu.vue +++ b/src/views/system/menu/components/Menu.vue @@ -49,7 +49,8 @@ - + @@ -230,10 +231,11 @@ function handleRowClick(row: any) { } async function handleAdd(row: any) { + state.formData.id = undefined await loadMenuData(); state.dialog = { title: "添加菜单", - visible: true, + visible: true }; if (row.id) { // 行点击新增 @@ -241,13 +243,13 @@ async function handleAdd(row: any) { if (row.id == '0') { state.formData.component = "Layout"; } else { - state.formData.component = ""; + state.formData.component = undefined; } } else { if (state.currentRow) { // 工具栏新增 state.formData.parentId = (state.currentRow as any).id; - state.formData.component = ""; + state.formData.component = undefined; } else { state.formData.parentId = "0"; state.formData.component = "Layout";