浏览代码

修改清空时查体闪一下bug 1638

zhouna 6 年之前
父节点
当前提交
1f5e6b454a
共有 1 个文件被更改,包括 7 次插入9 次删除
  1. 7 9
      src/components/CheckBody/index.jsx

+ 7 - 9
src/components/CheckBody/index.jsx

@@ -26,8 +26,13 @@ class CheckBody extends Component{
     this.showHide = this.showHide.bind(this);
     //this.handleInput = this.handleInput.bind(this);
   }
-  componentWillReceiveProps(nextProps){
-    this.setState({boxLeft:nextProps.boxLeft})
+  componentWillReceiveProps(next){
+    if((this.props.defaultShowAll&&!next.defaultShowAll)||(!this.props.defaultShowAll&&next.defaultShowAll)||(!this.props.isEmpty&&next.isEmpty)){
+      this.setState({
+        showAll:next.defaultShowAll
+      })
+    }
+    this.setState({boxLeft:next.boxLeft})
   }
   getLabels(){
     const {data,showArr,saveText,selecteds,importLabel} = this.props;
@@ -105,13 +110,6 @@ class CheckBody extends Component{
       showAll:!this.state.showAll
     });
   }
-  componentWillUpdate(next){
-    if((this.props.defaultShowAll&&!next.defaultShowAll)||(!this.props.defaultShowAll&&next.defaultShowAll)||(!this.props.isEmpty&&next.isEmpty)){
-      this.setState({
-        showAll:next.defaultShowAll
-      })
-    }
-  }
   render(){
     const {searchData,totalHide,data,boxLeft,boxTop,saveText} = this.props;