On the problem of push into an array of values selected by el-checkbox

An el-checkbox-group

requires that the value of the selected checkbox be put in an array. What is not selected is not in this array. The selected data will always be saved in the array
how to implement

.
chooseCardGrade (val){
        let cardGradeList = [];
        cardGradeList.push({
          cardGradeId:val.id,
          cardGradeName:val.name
        });
        console.log(cardGradeList);
      },

if you write this, check it and then cancel it or in the array

Mar.23,2021

you don't have to write this, you just define an array in data, and then bind the array to your check box group < el-checkbox-group > through v-model.


1. One of the features of vue.js is data binding (see official documents)
2. This problem can be solved through v-model binding array
3. The following is the code
HTML code. You can see the checkList
< el-checkbox-group vMube model = "checkForm.checkList" >

bound to the checkForm object by el-checkbox-group.
 <el-checkbox v-for="iteam in checkCodeList" :label="iteam.decodeId" :key="iteam.decodeId">{{iteam.decodeValue}}
 </el-checkbox>

< / el-checkbox-group >
object definition
checkForm: {

 checkList: [],//
 },

4. According to the above code, you can add a @ click event to grop to see if the value in checkList is the one you want

.
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b30963-2bd3c.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b30963-2bd3c.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?