소스 검색

解决查体数字输入后删除placeholder没有渲染问题

luolei 5 년 전
부모
커밋
9be53f0718
1개의 변경된 파일8개의 추가작업 그리고 0개의 파일을 삭제
  1. 8 0
      src/components/NumberDrop/index.jsx

+ 8 - 0
src/components/NumberDrop/index.jsx

@@ -195,6 +195,14 @@ class NumberDrop extends Component{
       saveDoms&&saveDoms(that.$span);
     })
   }
+  componentWillReceiveProps(nextProps){
+    if((nextProps.placeholder == this.props.placeholder)&&(nextProps.value == this.props.value)){
+      return
+    }
+    this.setState({
+      placeholder:nextProps.value||nextProps.placeholder
+    })
+  }
   render(){
     const {prefix,suffix,show,value,handleHide,allClick} = this.props;
     const {placeholder,hasSelect} = this.state;