From 9ee10ef7216830a667857f586c4cf475851107b6 Mon Sep 17 00:00:00 2001 From: liaozetao <1107136310@qq.com> Date: Thu, 23 Nov 2023 10:35:43 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=8F=9C=E5=8D=95=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/maintainer/index.vue | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/src/components/maintainer/index.vue b/src/components/maintainer/index.vue index bf72bac..a32aa21 100644 --- a/src/components/maintainer/index.vue +++ b/src/components/maintainer/index.vue @@ -131,17 +131,12 @@ export default { }, methods: { getMenu() { - // let parentMenus = getStore({ name: 'parent_menus' }); - // let childMenus = getStore({ name: 'child_menus' }); - // if (parentMenus && childMenus && parentMenus.length > 0 && childMenus.length > 0) { - // this.parentMenus = parentMenus; - // this.childMenus = childMenus; - // } else { - store.dispatch('getMenu').then(res => { - this.parentMenus = res.parents; - this.childMenus = res.childs; - }); - // } + this.parentMenus = getStore({ name: 'parent_menus' }); + this.childMenus = getStore({ name: 'child_menus' }); + store.dispatch('getMenu').then(res => { + this.parentMenus = res.parents; + this.childMenus = res.childs; + }); }, getChilds(parentId) { return this.childMenus.filter(v => v.parentid == parentId); @@ -171,9 +166,7 @@ export default { parentIds.push(v.id); }); } - console.log(parentIds); this.parentMenus = store.getters.parentMenus.filter(v1 => parentIds.filter(v2 => v1.id == v2).length > 0); - this.childMenus = store.getters.childMenus.filter(v1 => parentIds.filter(v2 => v1.parentid == v2).length > 0); } } },