今天在做项目的用Ant Design Vue框架写表格,遇到一个小bug分享记录一下!!!
a-table 选择框默认选中的值一直用的是上一次的值,解决这个问题也很简单获取数据的时候给他刷新实时时间。
具体操作看下图
data(){
return {
timer:undefined,
resourceTree: [],
columns,
}
}
<a-table
:columns="columns"
:data-source="resourceTree"
:row-selection="rowSelection"
:defaultExpandAllRows="true"
:row-key="(record)=>record.id"
:key="timer"
/>
然后再你改变默认选中的那个方法里面更新timer,这里方法里面赋值默认选中的代码我简化了
getBoundId(id){
this.timer = new Date().getTime()
}