Browse Source

数字键盘显示隐藏bug2882

zhouna 5 years atrás
parent
commit
4ced91c98c
1 changed files with 17 additions and 5 deletions
  1. 17 5
      src/components/NumberDrop/index.jsx

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

@@ -95,16 +95,28 @@ class NumberDrop extends Component{
       hasSelect:false
     });
   }
-  handleNumFocus(e){
+  handleNumFocus(e){console.log('focus')
     const {placeholder} = this.state;
-    const val = e.target.innerText.trim();
-    //console.log(33,e.target.innerText,placeholder,e.target.innerText.trim() == placeholder)
+    const val = e.target.innerText.trim();//console.log(33,e.target.innerText,placeholder,e.target.innerText.trim() == placeholder)
     if(val!=''&&val == placeholder){
       this.setState({
         placeholder:''
       });
     }
     e.stopPropagation();
+    const {show,handleShow,ikey,id,patId,handleHide} = this.props;
+    if(show) {
+      handleHide && handleHide();
+      return;
+    }else{
+      this.$span.current.focus();
+      this.setState({
+        hasSelect:false,
+        placeholder:''      //火狐26placeholder点击不隐藏bug修改
+      });
+      handleShow&&handleShow({ikey,id:patId||id});
+    }
+
   }
   handleKeyDowm(e){
     if(e.keyCode==13){
@@ -115,7 +127,7 @@ class NumberDrop extends Component{
   }
   handleNumClick(e){     //数字框不可编辑的状态时点击事件,点击将数字框变为可输入且下拉不再显示直到失焦后再次聚集
     e.stopPropagation();
-    const {show,handleShow,ikey,id,patId,handleHide} = this.props;
+    /*const {show,handleShow,ikey,id,patId,handleHide} = this.props;
     if(show) {
       handleHide && handleHide();
       return;
@@ -126,7 +138,7 @@ class NumberDrop extends Component{
         placeholder:''      //火狐26placeholder点击不隐藏bug修改
       });
       handleShow&&handleShow({ikey,id:patId||id});
-    }
+    }*/
   }
   validSymbols(txt,min,max){
     //输入只有一个~或/时判断两边是否为合理数字,有多个为不合理