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();
  }
 
posted on 2019-06-28 11:09  SuperTan  阅读(547)  评论(0编辑  收藏  举报