Commit 0843d50f by hfpp2012 yinsigan

add autobind

1 parent 1800ba88
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
"react": "^15.5.4", "react": "^15.5.4",
"react-addons-update": "^15.5.2", "react-addons-update": "^15.5.2",
"react-alert": "^2.0.1", "react-alert": "^2.0.1",
"react-autobind": "^1.0.6",
"react-bootstrap": "^0.31.0", "react-bootstrap": "^0.31.0",
"react-dom": "^15.5.4", "react-dom": "^15.5.4",
"react-router-dom": "^4.1.1", "react-router-dom": "^4.1.1",
......
import React from 'react' import React from 'react'
import Move from '../libs/move' import Move from '../libs/move'
import EventEmitter from '../libs/eventEmitter' import EventEmitter from '../libs/eventEmitter'
import autoBind from 'react-autobind'
export default class Element extends React.Component { export default class Element extends React.Component {
static get getDefaultProps() { static get getDefaultProps() {
...@@ -23,18 +24,7 @@ export default class Element extends React.Component { ...@@ -23,18 +24,7 @@ export default class Element extends React.Component {
name: this.props.name, name: this.props.name,
prev_name: this.props.name prev_name: this.props.name
}; };
this.onMouseDown = this.onMouseDown.bind(this); autoBind(this);
this.onMouseMove = this.onMouseMove.bind(this);
this.onMouseUp = this.onMouseUp.bind(this);
this.handleCloneElement = this.handleCloneElement.bind(this);
this.handleDeleteLastElement = this.handleDeleteLastElement.bind(this);
this.handleMoveDropZone = this.handleMoveDropZone.bind(this);
this.handleClick = this.handleClick.bind(this);
this.handleChange = this.handleChange.bind(this);
this.handleBlur = this.handleBlur.bind(this);
this.handleKeyPress = this.handleKeyPress.bind(this);
this.handleUpdateName = this.handleUpdateName.bind(this);
this.handleDoubleClick = this.handleDoubleClick.bind(this);
} }
componentDidUpdate(props, state) { componentDidUpdate(props, state) {
......
...@@ -3301,6 +3301,10 @@ react-alert@^2.0.1: ...@@ -3301,6 +3301,10 @@ react-alert@^2.0.1:
react-transition-group "^1.1.2" react-transition-group "^1.1.2"
shortid "^2.2.8" shortid "^2.2.8"
react-autobind@^1.0.6:
version "1.0.6"
resolved "http://registry.npm.taobao.org/react-autobind/download/react-autobind-1.0.6.tgz#936bb58edf6b89b619c50f82f0e617159fdfd4f1"
react-bootstrap@^0.31.0: react-bootstrap@^0.31.0:
version "0.31.0" version "0.31.0"
resolved "http://registry.npm.taobao.org/react-bootstrap/download/react-bootstrap-0.31.0.tgz#bbca804c0404d9c640102b2b656ae4cd5bea35c8" resolved "http://registry.npm.taobao.org/react-bootstrap/download/react-bootstrap-0.31.0.tgz#bbca804c0404d9c640102b2b656ae4cd5bea35c8"
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!