diff --git a/src/components/spreadSheet/index.tsx b/src/components/spreadSheet/index.tsx index 67011c77d..ac8569b03 100644 --- a/src/components/spreadSheet/index.tsx +++ b/src/components/spreadSheet/index.tsx @@ -24,6 +24,7 @@ export interface SpreadSheetProps { /** 字段类型 */ type: string; }>; + hotTableInstanceRef?: (instance: any) => void; } class SpreadSheet extends React.PureComponent { @@ -31,12 +32,15 @@ class SpreadSheet extends React.PureComponent { copyUtils = new CopyUtils(); _renderTimer: any; + componentDidMount() { + this.props.hotTableInstanceRef?.(this.tableRef.current); + } + componentDidUpdate(prevProps: any, _prevState: any) { if (prevProps != this.props) { if (this.tableRef) { this.removeRenderClock(); this._renderTimer = setTimeout(() => { - console.log('render sheet'); this.tableRef.current.hotInstance.render(); }, 100); }