vant-weapp使用

1.选中某个class类

<van-checkbox-group value="{{ result }}" bind:change="onChange"> <van-cell-group > <van-cell wx:for="{{ list }}" wx:key="index" title="复选框 {{ item }}" clickable data-name="{{ item }}" bind:click="toggle" > <van-checkbox catch:tap="noop" class="checkboxes-{{ item }}" name="{{ item }}" /> </van-cell> </van-cell-group> </van-checkbox-group>
使用selectComponent('class名称')选择
toggle(event) {
    const { name } = event.currentTarget.dataset;
    const checkbox = this.selectComponent(`.checkboxes-${name}`); checkbox.toggle(); }
 

猜你喜欢

转载自www.cnblogs.com/supertan/p/11101600.html