浏览代码

数字键盘前后缀也可唤出键盘

zhouna 6 年之前
父节点
当前提交
64ba4f9322
共有 3 个文件被更改,包括 8 次插入3 次删除
  1. 1 0
      src/components/MultSpread/index.jsx
  2. 6 3
      src/components/NumberDrop/index.jsx
  3. 1 0
      src/containers/eleType.js

+ 1 - 0
src/components/MultSpread/index.jsx

@@ -84,6 +84,7 @@ class MultSpread extends Component{
                              suffix={it.labelSuffix}
                              placeholder={it.name}
                              show={show}
+                             allClick={false}
                              ikey={inx}
                              id={it.id}
                              patId = {copyId}

+ 6 - 3
src/components/NumberDrop/index.jsx

@@ -11,6 +11,7 @@ import {handleEnter,getPageCoordinate} from '@utils/tools.js';
  * placeholder:灰显文字
  * handleSelect: 选中事件
  * show: 是否显示下拉
+ * allClick:是否前后缀也可唤出数字键盘
  *
  * ***/
 class NumberDrop extends Component{
@@ -57,8 +58,9 @@ class NumberDrop extends Component{
     }
     e.stopPropagation();
   }
-  handleNumClick(e){      //数字框不可编辑的状态时点击事件,点击将数字框变为可输入且下拉不再显示直到失焦后再次聚集
+  handleNumClick(e){     //数字框不可编辑的状态时点击事件,点击将数字框变为可输入且下拉不再显示直到失焦后再次聚集
     const {show,handleShow,ikey,id,patId,handleHide,value} = this.props;
+    this.$span.current.focus();
     if(show) {
       handleHide && handleHide();
       return;
@@ -175,17 +177,18 @@ class NumberDrop extends Component{
     this.$span.current.style.minWidth=spanWidth;
   }
   render(){
-    const {prefix,suffix,show,value,handleHide} = this.props;
+    const {prefix,suffix,show,value,handleHide,allClick} = this.props;
     const {numEditable,placeholder,editable,hasSelect,boxTop,boxLeft} = this.state;
     return <div className={this.getClasses()}
                 ref={this.$cont}
                 onDoubleClick={this.changeToEdit}
+                onClick={allClick?this.handleNumClick:null}
                 contentEditable={editable}
                 onBlur={this.handleBlur}
                 onkeydown={handleEnter}>
       <span ref = {this.$pre}>&nbsp;{prefix}</span>
       <span onFocus={this.handleNumFocus}
-            onClick={this.handleNumClick}
+            onClick={allClick?null:this.handleNumClick}
             contentEditable={true}
             style={{minWidth:'10px',display:'inline-block'}}
             ref = {this.$span}

+ 1 - 0
src/containers/eleType.js

@@ -77,6 +77,7 @@ export function singleRadio(params){
                          placeholder={data.name}
                          boxMark={boxMark}
                          id={data.id}
+                         allClick={true}
                          show={showArr&&showArr[showInx]}
                          ikey={showInx}
                          value={data.value}