<router-link v-for="(item,index) in list"
:key="item.value" :to="{path:item.path,query:{item:index}}"
:class="{'router-link-exact-active':ind == index}"
@click.native="changeBgc(index)" class="topbar-item"
>
{{item.label}}
</router-link>
export default {
data () {
return {
list: [
{path:'/main',label:'处理中心'},
{path:'/sys',label:'消息中心'},
],
ind: '0'
}
},
methods: {
changeBgc(index){
this.ind = index;
},
},
mounted(){
if(this.$route.query.item){
this.ind = this.$route.query.item;
}else{
this.ind = 0;
}
}
}