Antd vue (Table) remove the check after the table operation is completed

<template>
  <a-table :row-selection="rowSelection" :columns="columns" :data-source="data" />
</template>
export default { 
data () {
	return:{ 
      	 selectedRowKeys:[], // 批量选中的key
         select_rows:[]
	}
}
computed:{
	 rowSelection() {
	 	const { selectedRowKeys } = this;
      	return {
      		selectedRowKeys, // 一定要加上这一行代码,清除才会有作用
        	onChange: (selectedRowKeys, selectedRows) => { 
         	 	this.selectedRowKeys = selectedRowKeys
	            selectedRows.forEach((element) => {
	              this.id.push(element.id)
	            })
      		};
    	},
	},
	methods:{
		clearData () {
			this.selectedRowKeys = [] // 调用这个方法就有效果了
		}
	}
}

   select_rows : [], // Batch selected rows

   selectedRowKeys : [], // keys selected in batches

These two fields must be declared in the return

Guess you like

Origin blog.csdn.net/slow097/article/details/125727063
Recommended