feat: menu add parent

This commit is contained in:
xingyu 2022-10-14 16:37:18 +08:00
parent 00fbc7c5ba
commit cdeaf5b892
2 changed files with 11 additions and 5 deletions

View File

@ -36,7 +36,7 @@ const loginOut = () => {
}) })
.then(async () => { .then(async () => {
userStore.loginOut() userStore.loginOut()
tagsViewStore.delAllViews tagsViewStore.delAllViews()
replace('/login?redirect=/index') replace('/login?redirect=/index')
}) })
.catch(() => {}) .catch(() => {})

View File

@ -42,12 +42,18 @@ const menuProps = {
label: 'name', label: 'name',
value: 'id' value: 'id'
} }
const menuOptions = ref() // interface Tree {
id: number
name: string
children?: Tree[] | any[]
}
const menuOptions = ref<any[]>([]) //
const getTree = async () => { const getTree = async () => {
menuOptions.value = []
const res = await MenuApi.listSimpleMenusApi() const res = await MenuApi.listSimpleMenusApi()
const menu = { id: 0, name: '主类目', children: [] as any[] } let menu: Tree = { id: 0, name: '主类目', children: [] }
menu.children = handleTree(res) menu.children = handleTree(res)
menuOptions.value = menu menuOptions.value.push(menu)
} }
// ========== ========== // ========== ==========
const queryParams = reactive({ const queryParams = reactive({
@ -268,7 +274,7 @@ onMounted(async () => {
node-key="id" node-key="id"
v-model="menuForm.parentId" v-model="menuForm.parentId"
:props="menuProps" :props="menuProps"
:data="menuData" :data="menuOptions"
check-strictly check-strictly
/> />
</el-form-item> </el-form-item>