Select the multi-box in the table and add this item to the array, but if you click not to select it, it will also be added. How to solve the problem?

problem description

Select the multi-box in the

table and add this item to the array, but if you click not to select it, it will also be added. How to solve

the environmental background of the problems and what methods you have tried

related codes

/ / Please paste the code text below (do not replace the code with pictures)

< el-checkbox @ change= "getRow (scope.row)" VMI if = "scope.row.platformUsername" > < / el-checkbox >

getRow:function (row) {

   this.nextDataArr.push({"platfromLogo":row.platfromLogo,"platformZid":row.platformZid,"userPlat formZid":row.userPlatnameWithZid[0].userPlatformZid})

   },

what result do you expect? What is the error message actually seen?

error: I click, select, add data, and click not to select the array again will also add data

Mar.28,2021


v-model will help you maintain a list, that won't repeat push.


The js judgment array used in

defines a new array
getRow:function (row) {

because there is an object in my array.
if (this.nextDataArrry.indexOf(row.userPlatnameWithZid[0].userPlatformZid) === -1) {
     this.nextDataArrry.push(row.userPlatnameWithZid[0].userPlatformZid)this.nextDataArr.push({"platfromLogo":row.platfromLogo,"platformZid":row.platformZid,"userPlatformZid":row.userPlatnameWithZid[0].userPlatformZid})
        } else {
            this.nextDataArrry.splice(this.nextDataArrry.indexOf(row.userPlatnameWithZid[0].userPlatformZid), 1)
            this.nextDataArr.splice(this.nextDataArrry.indexOf(row.userPlatnameWithZid[0].userPlatformZid), 1)
        }
        console.log(this.nextDataArrry)
        console.log(this.nextDataArr)
   },

this is a solution.

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-1e45d83-59bb6.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-1e45d83-59bb6.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?