浏览代码

箭头函数弃用

zhouna 6 年之前
父节点
当前提交
2aee3200cb
共有 1 个文件被更改,包括 5 次插入2 次删除
  1. 5 2
      src/components/NumberDrop/index.jsx

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

@@ -248,6 +248,9 @@ class NumberDrop extends Component{
     const cls = this.props.show?style['blued']:'';
     return cls;
   }
+  stopBubble(e){
+    e.stopPropagation();
+  }
   componentDidMount(){
     //设置最小宽度避免输入后宽度跳动
     const spanWidth = window.getComputedStyle(this.$span.current).width;
@@ -262,12 +265,12 @@ class NumberDrop extends Component{
     //console.log(prefix,value,placeholder+'1',this.props.placeholder)
     return <div className={this.getClasses()}
                 ref={this.$cont}
-                onDoubleClick={this.changeToEdit}
+                onDblClick ={this.changeToEdit}
                 onClick={allClick?this.handleNumClick:null}
                 contentEditable={editable}
                 onBlur={this.handleBlur}
                 onKeyDown={handleEnter}
-                onFocus={(e)=>{e.stopPropagation()}}>
+                onFocus={this.stopBubble.bind(this)}>
       <span ref = {this.$pre}>&nbsp;{prefix}</span>
       <span onFocus={this.handleNumFocus}
             onClick={allClick?null:this.handleNumClick}