vue antd table树形数据展示
在使用vue antd 简单table-属性数据展示的时,遇到check或者radiobutton无法手动清除的情况,解决方案如下,table我没有封装直接使用。
解决方案代码展示
data() {
return {
dataSource: [],
columns,
rowSelection: {
selectedRowKeys: [],
onSelect: (record, selected, selectedRows) => {
this.selectedRows = selectedRows;
},
onChange: (selectedRowKeys) => {
this.rowSelection.selectedRowKeys = selectedRowKeys;
},
type: 'radio'
},
expandedRowKeys: [],
selectedRows: []
};
},
设置rowSelection内属性和方法,设置selectedRowKeys配合onChange给其赋值,onSelect用于selectedRows赋值
clearChecked() {
this.selectedRows = [];
this.rowSelection.selectedRowKeys = [];
},
清空selectedRows 所选内容
清空rowSelection.selectedRowKeys 中的key值