瀏覽代碼

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

zhouna 6 年之前
父節點
當前提交
ec0efcd32a
共有 1 個文件被更改,包括 9 次插入5 次删除
  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;
     }