项目中遇见过好多次这种展开收起的功能,所以就把他记下来
话不多说上代码
<div style="text-align: center;">
<el-button class="maybe_ckmx" v-if="show_maybetwo_con[index]
[n].show" @click="changeTit(index,n)">收起</el-button>
<el-button class="maybe_ckmx" v-else
@click="changeTit(index,n)">查看明细</el-button>
</div>
主题内容,v-if=“”
data里面的
方法里面的
methods: {
//切换可行性状态
changeTit(index,n){
this.show_maybetwo_con[index][n].show = !this.show_maybetwo_con[index][n].show ;
this.showMore = false;
this.$nextTick(()=>{
this.showMore = true;
})
},