vue tab切换

tab切换:

<html>

<div class="class-list">
<div class="name">品牌分类:</div>
<!--<span class="first-select select">全部</span>-->
<span @click="companyType(index)" ref="companyType" v-for="(item,index) in brand" v-bind:key="item.id"
:class="index == 0? 'first-selectd' : 'selectd'">{{item.name}}</span>
</div>
</html>
 
<js>
companyTypeEvent(index) {
this.$refs.companyType.forEach((ele, Mindex) => {
index === Mindex ? (this.$refs.companyType[Mindex].style.color = '#F9BE04')
: (this.$refs.companyType[Mindex].style.color = '#D3D3D2')

index === Mindex ? (this.$refs.companyType[Mindex].style.border = '1px solid #F9BE04')
: (this.$refs.companyType[Mindex].style.border = '1px solid #D3D3D2')
})
 
},
</js>
posted @ 2018-04-12 16:36  -http  阅读(129)  评论(0编辑  收藏  举报