Vue-easytable 控制台报“on-body-row-height-change” Cannot read properties of undefined (reading ‘height’)
查看官方文档;有这样一个属性:
官方给的虚拟滚动的示例:
<template>
<div>
<ve-table
:max-height="500"
:virtual-scroll-option="virtualScrollOption"
:columns="columns"
:table-data="tableData"
row-key-field-name="rowKey"
/>
</div>
</template>
rowKey的设置在数据源里面
initData() {
let data = [];
for (let i = 0; i < 10000; i++) {
data.push({
rowKey: i,
index: i,
name: `name${i}`,
hobby: `hobby${i}`,
address: `address${i}`,
});
}
this.tableData = data;
},
因此报错的原因是rowkey设置成唯一的值,就不会报错了
utils.generateUUID(); 是一个生成随机uuid的方法;确保唯一性。
tempData.forEach(function(item,index){
item.rowKey=index+utils.generateUUID();
})