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