diff --git a/README-zh.md b/README-zh.md index a2436bf..ae9e195 100644 --- a/README-zh.md +++ b/README-zh.md @@ -62,40 +62,7 @@ hotkeys('ctrl+a,ctrl+b,r,f', function(event,handler) { npm i -S react-hot-keys ``` -例子 - -```js -import React, { Component } from 'react'; -import Hotkeys from 'react-hot-keys'; - -export default class HotkeysDemo extends Component { - constructor(props) { - super(props); - this.state = { - output: 'Hello, I am a component that listens to keydown and keyup of a', - } - } - onKeyUp(keyName, e, handle) { - console.log("test:onKeyUp", e, handle) - this.setState({ output: `onKeyUp ${keyName}` }); - } - onKeyDown(keyName, e, handle) { - console.log("test:onKeyDown", keyName, e, handle) - this.setState({ output: `onKeyDown ${keyName}` }); - } - render() { - return ( - -
{this.state.output}
-
- ) - } -} -``` +详细使用方法请参考文档 [react-hotkeys](https://github.com/jaywcjlove/react-hotkeys)。 ## 使用 diff --git a/README.md b/README.md index 9e6f53b..a3c8fdc 100644 --- a/README.md +++ b/README.md @@ -58,37 +58,6 @@ $ npm install react-hot-keys --save Detailed use method please see its documentation [react-hotkeys](https://github.com/jaywcjlove/react-hotkeys). -```jsx -import React, { Component } from 'react'; -import Hotkeys from 'react-hot-keys'; - -export default class HotkeysDemo extends Component { - constructor(props) { - super(props); - this.state = { - output: 'Hello, I am a component that listens to keydown and keyup of a', - } - } - onKeyUp(keyNm, e, handle) { - this.setState({output: keyNm}) - } - onKeyDown(keyName, e, handle) { - this.setState({output: keyNm}) - } - render() { - return ( - -
{this.state.output}
-
- ) - } -} -``` - ## Browser Support Hotkeys.js has been tested and should work in.