How does element control the switch status of each line?

how do I control the status of each line based on the backend return value? How do you control each line? Write scope.row.on and report an error directly. Scope, can"t get it

.

clipboard.png

       this.$get("/api/shop", this.getDate).then(res => {
          console.log(this.scope); //undefined     
          console.log(scope);      //scope is not defined
      }



      <el-table-column width="200%" label="" class="switchVal">
        <template slot-scope="scope">
          <el-switch
            @change="changeSwitch(scope.$index, scope.row)"
            v-model="scope.row.on"
            active-text=""
            inactive-text="">
            on-color="-sharp00A854"
            on-text=""
            on-value="1"
            off-color="-sharpF04134"
            off-text=""
            off-value="0"
            >
          </el-switch>
        </template>
      </el-table-column>
      
      
      
      
   changeSwitch(index, row) {
    if (row.on) {
      this.$confirm("", "", {
        confirmButtonText: "",
        cancelButtonText: "",
        type: "warning"
      }).then(() => {
        row.on = true
      }).catch(() => {
        row.on = false
      });
    }else {
      this.$confirm("", "", {
        confirmButtonText: "",
        cancelButtonText: "",
        type: "warning"
      }).then(() => {
        row.on = false
      }).catch(() => {
        row.on = true
      });
    }
  },
Jun.02,2021

you wrote this, adding a field on, or something else to each row of the data. Is a Boolean value, and then by modifying this value and updating switch., the change in switch can also be changed to this value immediately

scope.row.on

MVVM is data-driven, and when the data is modified, the View changes naturally. So just change the v-model


now scope can't get it. Does it have anything to do with the control switch?
how to get the code that assigns the scope?

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