<view class="recharge_num" :class="{'active':add_class==1}" @click="addClass(1)">
</view>
<script>
export default {
data() {
return {
add_class:'',
}
},
methods: {
// 动态添加class
addClass(index){
this.add_class=index;
}
}
}
</script>
uni-app点击给当前元素动态添加class
最新推荐文章于 2024-09-19 13:54:51 发布