您的位置:首页 > Web前端 > Vue.js

vue动态绑定class,tab切换非常好用

2019-06-14 10:50 1636 查看
<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
}
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: