<ul class="nij"> <li v-for="item in nav" @click="selectNav(item.title)"> <p :class="isSelect === item.title ? ‘active‘ : ‘‘">{{item.title}}</p> </li> </ul>
data:function(){
return{
isSelect: ‘senUs‘,
nav: [
{title: ‘senUs‘},
{title: ‘senGermany‘},
{title: ‘senFrance‘},
{title: ‘senUk‘}
]
}
},
methods:{ selectNav (title) { var that=this; this.$nextTick(function(){ that.isSelect = that.$route.name }) switch (title) { case ‘senUs‘: this.$router.push(‘/sentiSectors/senUs‘) break case ‘senGermany‘: this.$router.push(‘/sentiSectors/senGermany‘) break case ‘senFrance‘: this.$router.push(‘/sentiSectors/senFrance‘) break case ‘senUk‘: this.$router.push(‘/sentiSectors/senUk‘) break } } }, mounted(){ this.isSelect = this.$route.name; },
.nij{ p{ line-height:30px; } } .active{ color: #ffd100; }