Commit 6354207a by 姜雷

修改收藏菜单

parent d2906adf
...@@ -122,30 +122,7 @@ export default { ...@@ -122,30 +122,7 @@ export default {
}, },
data() { data() {
return { return {
menuList: [ collectRouteList: [],
{
path: '/OperLog',
name: '19',
meta: { title: '后台操作日志', icon: '' },
},
{
path: '/interface',
name: '27',
meta: { title: '接口管理', icon: '' },
children: [
{
path: '/interface/interfaceApp',
name: '29',
meta: { title: 'APP接口', icon: '' },
},
{
path: '/interface/interfaceManager',
name: '30',
meta: { title: '后台接口', icon: '' },
},
],
},
],
}; };
}, },
computed: { computed: {
...@@ -175,25 +152,35 @@ export default { ...@@ -175,25 +152,35 @@ export default {
); );
return item ? true : false; return item ? true : false;
}, },
collectRouteList() { // collectRouteList() {
if ( // let list = this.collectList.map(item => {
this.routers && // let id = item.menuId;
this.routers.length && // return getFilterMenu(this.routers, id);
this.collectList && // });
this.collectList.length // list = list.filter(item => !!item);
) { // return list ? formatRouteLink(list) : null;
let list = this.collectList.map(item => { // },
},
watch: {
collectList(val) {
this.getCollectList(val);
},
},
mounted() {
this.getCollectList(this.collectList);
},
methods: {
getCollectList(val) {
let list = val.map(item => {
let id = item.menuId; let id = item.menuId;
return getFilterMenu(this.routers, id); return getFilterMenu(this.routers, id);
}); });
console.log(list);
list = list.filter(item => !!item); list = list.filter(item => !!item);
return list ? formatRouteLink(list) : null; console.log(list);
} else {
return null; this.collectRouteList = list && list.length ? formatRouteLink(list) : [];
}
},
}, },
methods: {
clickHandle() { clickHandle() {
if (this.dashboardVisiable) { if (this.dashboardVisiable) {
this.$router.go(-1); this.$router.go(-1);
......
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
<div <div
ref="MenuItem" ref="MenuItem"
:class="`MenuItem ${showSubMenus?'Selected':''}`" :class="`MenuItem ${showSubMenus?'Selected':''}`"
@mouseenter="toggleSubmenus" @mouseenter="toggleSubmenus(true)"
@mouseleave="toggleSubmenus" @mouseleave="toggleSubmenus(false)"
> >
<div <div
class="IconMenu" class="IconMenu"
...@@ -116,8 +116,8 @@ export default { ...@@ -116,8 +116,8 @@ export default {
} }
}, },
methods: { methods: {
toggleSubmenus() { toggleSubmenus(visiable) {
this.showSubMenus = !this.showSubMenus; this.showSubMenus = visiable;
}, },
selectHandle() { selectHandle() {
if (typeof this.selectRouteMenu === 'function') { if (typeof this.selectRouteMenu === 'function') {
......
...@@ -35,7 +35,7 @@ const actions = { ...@@ -35,7 +35,7 @@ const actions = {
return addCollect({ return addCollect({
data: { ...entity, sortId: getters.collectList.length + 1 }, data: { ...entity, sortId: getters.collectList.length + 1 },
}).then(res => { }).then(res => {
commit(ADD_COLLECT_LIST, entity.menuId); commit(ADD_COLLECT_LIST, Number(entity.menuId));
}); });
}, },
delCollect({ commit }, entity) { delCollect({ commit }, entity) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment