Explorar o código

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

luolei %!s(int64=5) %!d(string=hai) anos
pai
achega
9be53f0718
Modificáronse 1 ficheiros con 8 adicións e 0 borrados
  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;