From f25d46a5cfdc9cab3981e50255a5e82f72eba686 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期五, 22 五月 2020 14:13:31 +0800 Subject: [PATCH] 2020-05-22 --- src/templates/sharecomponent/columncomponent/index.jsx | 10 +++++++--- 1 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/templates/sharecomponent/columncomponent/index.jsx b/src/templates/sharecomponent/columncomponent/index.jsx index 0d7d14d..0c00f78 100644 --- a/src/templates/sharecomponent/columncomponent/index.jsx +++ b/src/templates/sharecomponent/columncomponent/index.jsx @@ -49,17 +49,21 @@ * @description 鐩戝惉鍒版樉绀哄垪澶嶅埗鏃讹紝瑙﹀彂鏄剧ず鍒楃紪杈� */ UNSAFE_componentWillReceiveProps (nextProps) { + const { config } = this.props const { columnlist } = this.state if ( nextProps.pasteContent && - columnlist.length === 0 && nextProps.pasteContent.columns && nextProps.pasteContent.copyType === 'columns' && nextProps.pasteContent.columns.length > 0 ) { - this.setState({columnlist: nextProps.pasteContent.columns}) - } else if (!is(fromJS(nextProps.config.columns), fromJS(this.props.config.columns)) && !is(fromJS(nextProps.config.columns), fromJS(columnlist))) { + if (columnlist.filter(col => !col.origin).length === 0) { + this.setState({columnlist: nextProps.pasteContent.columns}, () => { + this.props.updatecolumn({...config, columns: nextProps.pasteContent.columns}) + }) + } + } else if (!is(fromJS(nextProps.config.columns), fromJS(config.columns)) && !is(fromJS(nextProps.config.columns), fromJS(columnlist))) { this.setState({columnlist: fromJS(nextProps.config.columns).toJS()}) } } -- Gitblit v1.8.0