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
@ open="handleOpen"
@ close="handleClose"
: default - active="selectedIndex
"Active - text - color="# 409 eff
"The text - color="# FFF
"The router
: unique - the opened="true"
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 ');
})