How does the iview Table component obtain the currently checked data through the on-select method

if you want to get the selected data when the table is checked, the code is as follows:

<div>
    <Table border ref="selection" :columns="columns4" :data="data1" 
        @on-select = "selectTable(selection,row)"></Table>
    <Button @click="handleSelectAll(true)">Set all selected</Button>
    <Button @click="handleSelectAll(false)">Cancel all selected</Button>
</div>


export default {
    data () {
        return {
            selection:"",
            row:"",
            columns4: [
                {
                    type: "selection",
                    width: 60,
                    align: "center"
                },
                {
                    title: "Name",
                    key: "name"
                },
                {
                    title: "Age",
                    key: "age"
                },
                {
                    title: "Address",
                    key: "address"
                }
            ],
            data1: [
                {
                    name: "John Brown",
                    age: 18,
                    address: "New York No. 1 Lake Park",
                    date: "2016-10-03"
                },
                {
                    name: "Jim Green",
                    age: 24,
                    address: "London No. 1 Lake Park",
                    date: "2016-10-01"
                },
                {
                    name: "Joe Black",
                    age: 30,
                    address: "Sydney No. 1 Lake Park",
                    date: "2016-10-02"
                },
                {
                    name: "Jon Snow",
                    age: 26,
                    address: "Ottawa No. 2 Lake Park",
                    date: "2016-10-04"
                }
            ]
        }
    },
    methods: {
        handleSelectAll (status) {
            this.$refs.selection.selectAll(status);
        },
      selectTable(){
        console.log(this.selection+this.row)
      }
    }
}

on-selectselectionrow



clipboard.png

Jan.27,2022

the return value here is the parameter received by your selectTable (not a property of this), which you can see by declaring the parameter and printing it.
in addition, table rendering is really slow (the amount of data is especially prominent), so don't use this form of presentation unless it is necessary.


paste the code directly:

clipboard.png


selection, row is provided with the default api interface function. Do not use this to express

.
  selectTable(){
    console.log(this.selection+this.row)
  }
  
  selectTable(selection, row){
    console.log(selection + row)
  }
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-1b3df4f-2bb50.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-1b3df4f-2bb50.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?