vant-weapp use

1. Select a class 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(); }
 

Guess you like

Origin www.cnblogs.com/supertan/p/11101600.html