Selaa lähdekoodia

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

luolei 5 vuotta sitten
vanhempi
commit
9be53f0718
1 muutettua tiedostoa jossa 8 lisäystä ja 0 poistoa
  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;