Bläddra i källkod

第一次选中数字时placeholder闪一下优化

zhouna 6 år sedan
förälder
incheckning
ec0efcd32a
1 ändrade filer med 9 tillägg och 5 borttagningar
  1. 9 5
      src/components/NumberDrop/index.jsx

+ 9 - 5
src/components/NumberDrop/index.jsx

@@ -93,11 +93,15 @@ class NumberDrop extends Component{
   }
   numInpBlur(e){        //数字框失焦,保存值到store中
     e.stopPropagation();
-    if(!e.target.innerText.trim()){
-      this.setState({
-        placeholder:this.props.placeholder
-      });
-    }
+    const that = this;
+    setTimeout(function(){      //第一次选中数字时placeholder闪一下优化
+      if(!that.state.hasSelect&&!e.target.innerText.trim()){
+        that.setState({
+          placeholder:that.props.placeholder
+        });
+      }
+    },100);
+
     if(this.props.show){      //修改清空后第一次点击键盘不触发click事件bug
       return;
     }