优化页面按钮显示的逻辑
This commit is contained in:
@@ -122,8 +122,6 @@
|
|||||||
let oldIndex = this.linkList.indexOf(newRoute.fullPath)
|
let oldIndex = this.linkList.indexOf(newRoute.fullPath)
|
||||||
let oldPositionRoute = this.pageList[oldIndex]
|
let oldPositionRoute = this.pageList[oldIndex]
|
||||||
this.pageList.splice(oldIndex, 1, Object.assign({},newRoute,{meta:oldPositionRoute.meta}))
|
this.pageList.splice(oldIndex, 1, Object.assign({},newRoute,{meta:oldPositionRoute.meta}))
|
||||||
//给菜单id赋值,用于调用之后控制按钮的显示
|
|
||||||
Vue.ls.set('funId', oldPositionRoute.meta.id, 7 * 24 * 60 * 60 * 1000)
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
'activePage': function(key) {
|
'activePage': function(key) {
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
<side-menu
|
<side-menu
|
||||||
mode="inline"
|
mode="inline"
|
||||||
:menus="menus"
|
:menus="menus"
|
||||||
@menuSelect="myMenuSelectMobile"
|
@menuSelect="myMenuSelect"
|
||||||
:theme="navTheme"
|
:theme="navTheme"
|
||||||
:collapsed="false"
|
:collapsed="false"
|
||||||
:collapsible="true"></side-menu>
|
:collapsible="true"></side-menu>
|
||||||
@@ -157,11 +157,6 @@
|
|||||||
let storeKey = 'route:title:' + this.activeMenu.url
|
let storeKey = 'route:title:' + this.activeMenu.url
|
||||||
this.$ls.set(storeKey, this.activeMenu.text)
|
this.$ls.set(storeKey, this.activeMenu.text)
|
||||||
},
|
},
|
||||||
myMenuSelectMobile(value){
|
|
||||||
this.myMenuSelect(value)
|
|
||||||
//给菜单id赋值,用于调用之后控制按钮的显示
|
|
||||||
Vue.ls.set('funId', this.activeMenu.id, 7 * 24 * 60 * 60 * 1000);
|
|
||||||
},
|
|
||||||
findMenuBykey(menus,key){
|
findMenuBykey(menus,key){
|
||||||
for(let i of menus){
|
for(let i of menus){
|
||||||
if(i.url==key){
|
if(i.url==key){
|
||||||
|
|||||||
@@ -351,12 +351,11 @@ export const JeecgListMixin = {
|
|||||||
},
|
},
|
||||||
/* 按钮权限 */
|
/* 按钮权限 */
|
||||||
initActiveBtnStr() {
|
initActiveBtnStr() {
|
||||||
let funId = Vue.ls.get('funId'); //功能id
|
|
||||||
let btnStrList = Vue.ls.get('winBtnStrList'); //按钮功能列表 JSON字符串
|
let btnStrList = Vue.ls.get('winBtnStrList'); //按钮功能列表 JSON字符串
|
||||||
this.btnEnableList = ""; //按钮列表
|
this.btnEnableList = ""; //按钮列表
|
||||||
if (funId && btnStrList) {
|
if (location.pathname && btnStrList) {
|
||||||
for (let i = 0; i < btnStrList.length; i++) {
|
for (let i = 0; i < btnStrList.length; i++) {
|
||||||
if (btnStrList[i].funId == funId) {
|
if (btnStrList[i].url === location.pathname) {
|
||||||
if (btnStrList[i].btnStr) {
|
if (btnStrList[i].btnStr) {
|
||||||
this.btnEnableList = btnStrList[i].btnStr;
|
this.btnEnableList = btnStrList[i].btnStr;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user