修改菜单读取逻辑
This commit is contained in:
@@ -105,6 +105,7 @@
|
||||
|
||||
<script>
|
||||
import store from '@/store';
|
||||
import { getStore } from '@/utils/store';
|
||||
import loading from '@/assets/images/loading.gif';
|
||||
|
||||
export default {
|
||||
@@ -130,10 +131,17 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
getMenu() {
|
||||
store.dispatch('getMenu').then(res => {
|
||||
this.parentMenus = res.parents;
|
||||
this.childMenus = res.childs;
|
||||
});
|
||||
let parentMenus = getStore({ name: 'parent_menus' });
|
||||
let childMenus = getStore({ name: 'child_menus' });
|
||||
if (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;
|
||||
});
|
||||
}
|
||||
},
|
||||
getChilds(parentId) {
|
||||
return this.childMenus.filter(v => v.parentid == parentId);
|
||||
|
Reference in New Issue
Block a user