vue动态绑定class,tab切换非常好用
<div @click="tab('left')" v-bind:class="{ 'decoration-line':showLeft}" class="col-xs-6 col-md-6 text-center theme-color item" >
排班信息
</div>
<div @click="tab('right')" v-bind:class="{ 'decoration-line':showRight}" class="col-xs-6 col-md-6 text-center item" >
医生简介
</div>
data() {
return {
showLeft : true,
showRight : false
}
},
tab(type) {
if (type === 'left'){
this.showLeft = true
this.showRight = false
}else{
this.showLeft = false
this.showRight = true
}
}
还没有评论,来说两句吧...