|
|
@@ -97,6 +97,7 @@ export default {
|
|
|
themeColor: state => state.app.themeColor,
|
|
|
collapse: state => state.app.collapse,
|
|
|
navTree: state => state.menu.navTree,
|
|
|
+ leftTree: state => state.menu.leftTree,
|
|
|
}),
|
|
|
leftNavItems: function () {
|
|
|
if (this.sum > 0) {
|
|
|
@@ -127,14 +128,13 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
created() {
|
|
|
-
|
|
|
+ if(localStorage.getItem("routerId")){
|
|
|
+ this.$store.commit('changeLeftTree', localStorage.getItem("routerId"));
|
|
|
+ }
|
|
|
if(!JSON.parse(localStorage.getItem('user_data'))){
|
|
|
this.$api.user.getLoginUser().then((response) => {
|
|
|
- this.userData=response.data
|
|
|
- })
|
|
|
- }
|
|
|
- if(localStorage.getItem("routerId")){
|
|
|
- this.$store.commit('changeLeftTree', localStorage.getItem("routerId"));
|
|
|
+ this.userData=response.data
|
|
|
+ })
|
|
|
}
|
|
|
if (this.leftNavItems.length > 8) {
|
|
|
if (this.screenWidth < this.datawidth) {
|
|
|
@@ -153,6 +153,11 @@ export default {
|
|
|
|
|
|
},
|
|
|
watch: {
|
|
|
+ navTree(newValue){
|
|
|
+ if(localStorage.getItem("routerId") && newValue.length>0){
|
|
|
+ this.$store.commit('changeLeftTree', localStorage.getItem("routerId"));
|
|
|
+ }
|
|
|
+ },
|
|
|
screenWidth(newValue) {
|
|
|
this.sum = Math.ceil((this.datawidth - newValue) / 70)
|
|
|
// 为了避免频繁触发resize函数导致页面卡顿,使用定时器
|