代码演示

    基础用法

    1. <van-checkbox v-model="checked">复选框</van-checkbox>
    1. export default {
    2. return {
    3. checked: true
    4. };
    5. }
    6. };

    禁用状态

    禁用内容部分点击事件

    1. <van-checkbox v-model="checked" label-disabled>复选框</van-checkbox>

    Checkbox 组

    1. <van-checkbox-group v-model="result">
    2. <van-checkbox
    3. v-for="(item, index) in list"
    4. :key="item"
    5. >
    6. 复选框 {{ item }}
    7. </van-checkbox>

    设置最大可选数

    1. <van-checkbox-group v-model="result" :max="2">
    2. <van-checkbox
    3. v-for="(item, index) in list"
    4. :key="item"
    5. :name="item"
    6. >
    7. 复选框 {{ item }}
    8. </van-checkbox>
    9. </van-checkbox-group>

    与 Cell 组件一起使用

    1. <van-checkbox-group v-model="result">
    2. <van-cell-group>
    3. <van-cell v-for="item in list" :title="`复选框 - {item}`" :key="item">
    4. </van-cell>
    5. </van-checkbox-group>

    CheckboxGroup API

    CheckboxGroup Event