feat: setRowHeight性能优化

This commit is contained in:
liushaozhen 2020-07-23 09:38:08 +08:00
parent 286a4f43be
commit bc5aa63851
6 changed files with 122 additions and 88 deletions

File diff suppressed because one or more lines are too long

194
dist/demo.js vendored

File diff suppressed because one or more lines are too long

2
dist/demo.js.map vendored

File diff suppressed because one or more lines are too long

View File

@ -87,6 +87,7 @@ import 'bee-table/build/Table.css';
| [v2.2.8新增]autoSelect | 树型表格勾选时,是否开启子节点的联动 | bool | false |
| onPaste | 粘贴的回调函数 | func(event,positon) | - |
| onBodyScroll | table body 滚动的回调 | func(scrollTop) | - |
| syncRowHeight | 滚动是否同步高度,关闭此功能有利于提高性能,注:树表和主子表不允许关闭 | true | - |
> 快捷键部分参考示例 (快捷键在table中的简单使用应用)

View File

@ -98,7 +98,7 @@ const defaultProps = {
minColumnWidth: 80,
locale:{},
syncHover: true,
setRowHeight:()=>{},
// setRowHeight:()=>{},
setRowParentIndex:()=>{},
tabIndex:'0',
heightConsistent:false,

View File

@ -33,6 +33,7 @@ const propTypes = {
rowDraggAble: PropTypes.bool,
onDragRow: PropTypes.func,
onDragRowStart: PropTypes.func,
syncRowHeight:PropTypes.bool
};
const defaultProps = {
@ -46,6 +47,7 @@ const defaultProps = {
setRowParentIndex:()=>{},
rowDraggAble:false,
// onDragRow:()=>{}
syncRowHeight:false
};
class TableRow extends Component{
@ -339,18 +341,19 @@ class TableRow extends Component{
}
componentDidUpdate(prevProps) {
const { rowDraggAble } = this.props;
const { rowDraggAble,syncRowHeight } = this.props;
if(!this.event){
this.event = true;
if(rowDraggAble){
this.initEvent();
}
}
if(this.props.treeType){
this.setRowParentIndex();
}
this.setRowHeight()
if(syncRowHeight){
this.setRowHeight()
}
}
componentWillUnmount() {