|
@@ -11,14 +11,14 @@
|
|
|
</div>
|
|
|
|
|
|
<ul class="m-left-list">
|
|
|
- <li v-for="(item, index) in menu" :key="index" :class="{'current':item.active}">
|
|
|
+ <li v-for="(item, index) in menu" :key="index" :class="{'current':item.active||item.show}">
|
|
|
|
|
|
<a href="javascript:void(0)" style="text-decoration: none" @click="goState(item)"
|
|
|
class="ng-binding"><span class="p-ico2" :class="item.icon" ></span>{{item.name}}</a>
|
|
|
|
|
|
<div class="sub-list ng-scope" v-if="item.children" >
|
|
|
<a v-for="subItem in item.children" :key="subItem.path" v-if="!subItem.hidden"
|
|
|
- @click="goSubState(subItem)" :class="{'current':subItem.active}" href="javascript:void(0)"
|
|
|
+ @click="goState2(subItem, item)" :class="{'current':$route.path == subItem.path}" href="javascript:void(0)"
|
|
|
class="ng-binding ng-scope">{{subItem.name}}</a>
|
|
|
</div>
|
|
|
</li>
|
|
@@ -61,21 +61,40 @@
|
|
|
if( item.path != path ){
|
|
|
item.active = false
|
|
|
}
|
|
|
+ this.unActiveChild(path, this.menu[i].children)
|
|
|
+ }
|
|
|
+ },
|
|
|
+ unActiveChild( path, children ){
|
|
|
+ if(!children) return;
|
|
|
+ for( let i in children){
|
|
|
+ let item = children[i];
|
|
|
+ item.active = item.path == path;
|
|
|
}
|
|
|
},
|
|
|
goState( item ){
|
|
|
+ this.allUnactive(this.$route.path)
|
|
|
if( item.children ){
|
|
|
item.active = !item.active;
|
|
|
if( item.active ){
|
|
|
this.allUnactive( item.path )
|
|
|
+ item.children[0].active = true
|
|
|
}
|
|
|
}else{
|
|
|
- this.goSubState( item );
|
|
|
+ this.goSubState(item);
|
|
|
}
|
|
|
},
|
|
|
+ goState2(child, parent){
|
|
|
+ parent.active = true;
|
|
|
+ this.unActiveChild( child.path, parent.children);
|
|
|
+ this.goSubState(child)
|
|
|
+ },
|
|
|
goSubState(item){
|
|
|
if(item.path == this.$route.path) return;
|
|
|
item.active = true;
|
|
|
+ window.scrollTo({
|
|
|
+ top: 0,
|
|
|
+ behavior: 'smooth' // 平滑滚动效果
|
|
|
+ });
|
|
|
this.$router.push(item.path);
|
|
|
}
|
|
|
}
|