表单滚动条滚动不到最底下
描述:表单有58行,但是滚动条只能滚动到33行。
原因:行高不一致,导致计算不准确
解决办法:rowHeights: 25, // 统一行高,确保计算准确,初始化定义即可,在其他地方不要再赋值
对单元格数据进行格式化,但是会无限循环导致页面卡死
解决办法:// 这里必须写后面的"format",不然会不停循环更新单元格
this.hot.setDataAtCell(
row,
col,
Number(newValue).toFixed(2),
"format"
);
点击查看代码
afterChange(changes, source) {changes?.forEach(([row, col, oldValue, newValue]) => {// if (// typeof this.currentCellVal === "string" &&// this.currentCellVal.match(/^[<>!=]+\s*\(.*\)$/)// ) {// 改成右键菜单定义配置console.log('source', source);if (source === "edit") {if (this.customizeCheckData &&this.customizeCheckData[row + "-" + col] && typeof this.customizeCheckData[row + "-" + col]?.split('compare-')[1] === "string" &&this.customizeCheckData[row + "-" + col]?.split('compare-')[1].match(/^[<>!=]+\s*\(.*\)$/)) {let compareFomrula = this.customizeCheckData[row + "-" + col]?.split('compare-')[1]console.log('compareFomrula=', compareFomrula)this.parseFormula(compareFomrula, row, col, Number(newValue).toFixed(2));// 这里必须写后面的"format",不然会不停循环更新单元格this.hot.setDataAtCell(row,col,Number(newValue).toFixed(2),"format");}}});
由于修改了表单横向滚动条高度,导致表单数据错行
解决办法:取消滚动条样式修改