当前位置:网站首页>Single box check box

Single box check box

2022-07-05 02:44:00 13 less

One . Use of check boxes

<template>
<div>
   {
   {checkList}}
     <el-checkbox-group v-model="checkList">
    <el-checkbox label=" Check box  A"></el-checkbox>
    <el-checkbox label=" Check box  B"></el-checkbox>
    <el-checkbox label=" Check box  C"></el-checkbox>
  </el-checkbox-group>
</div>

</template>

<script>
  export default {
    data () {
      return {
        checkList: []
      };
    }
  };
</script>

analysis :

v-model Binding is an array , The selected items will be in this array .

Two . Use of radio boxes

<template>
  <el-radio-group v-model="radio">
    <el-radio :label="3"> Options </el-radio>
    <el-radio :label="6"> Options </el-radio>
    <el-radio :label="9"> Options </el-radio>
  </el-radio-group>
</template>

<script>
  export default {
    data () {
      return {
        radio: 6
      };
    }
  }
</script>

adopt v-model Association , Bind a value in both directions .

Value and label Make a correspondence , Display as many values as you select .

原网站

版权声明
本文为[13 less]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/186/202207050241199186.html