Home > front end >  About element - UI Settings by default - openeds="" menu bar. In my page button to jump to
About element - UI Settings by default - openeds="" menu bar. In my page button to jump to

Time:09-22

Because of the page can pass on the left side of the menu bar, open the jump, but sometimes the page may be button click through this. $router. Push () jump
Page button to jump to another page, want to page belongs to the left side menu to open the corresponding submenu,

I used to element - the UI Settings through: the default - openeds="" to set up,
When this page button. $router. Push (), jump time to define an index value, to vuex mutation, stored in the state,
Then on the left side menu component extracted vuex state's index value,
Then the value has been changed before 2, behind the 2 to 1, or 2, and do the menu is opened, but the menu back confiscated and click other menu also have no reaction, the console and error

I want to do is that the effect of jump page, the corresponding menu can unfold, and can recover, not an error
//the left side menu component

: default - openeds='selectedIndexs'
@ open="handleOpen"
@ close="handleClose"
: default - active="selectedIndex
"Active - text - color="# 409 eff
"The text - color="# FFF
"The router
: unique - the opened="true"

: index="item. Id +" '"
V - for="(item) in menus"
: key="item. Id"


-->







: index="'/home/+ subitem. Path"
V - for="subitem item. In the children"
: key="subitem. Id"




-->




Data () {
Return {
Slideindex: 2,
SelectedIndexs: [' 1 '],
SelectedIndex: "1",
}
Watch: {
'selectedIndexs: {
Handler: function (val, oldval) {
If (val!=={oldval)
Enclosing getNavType ()
Window. The console. The log (' modified ', val, 'before' oldval);
}

},
},
},
The computed: {
. MapState ([' selectSideIndexs '])
},
Created () {
},
Mounted () {
Enclosing selectedIndexs=this. SelectSideIndexs;
}


State: {
SelectSideIndexs: [],
},
Mutations: {
//jump routing, the sidebar corresponding routing activation
AsideMenuIndex (state, selectedIndex) {
State. SelectSideIndexs=[]
State. SelectSideIndexs=selectedIndex;
Window. The console. The log (selectedIndex, "I am a active menu selectedIndex")
//the window. The console. The log (user Authorization + "222")
//the window. The localStorage. SetItem (' Authorization 'user. Authorization);
},
},



//to jump page

Methods: {
. MapMutations ([' changeLogin ', 'saveUserName', 'asideMenuIndex']),
HandleLogin () {
GetTest (enclosing loginForm). Then (res=& gt; {
Let asideMenuIndexs=(" 2 ")
Enclosing asideMenuIndex (asideMenuIndexs)
This. $router. Push ('/home ');

})
  • Related