Skip to content

Commit

Permalink
fixes README example mistake
Browse files Browse the repository at this point in the history
  • Loading branch information
minwe committed Apr 25, 2016
1 parent 2e48207 commit 286b9d9
Showing 1 changed file with 47 additions and 44 deletions.
91 changes: 47 additions & 44 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,53 +33,56 @@ Amaze UI Touch 专为移动打造,在技术实现、交互设计上只考虑

1. 从 npm 安装:

``` bash
npm install --save-dev amazeui-touch
```
``` bash
npm install --save-dev amazeui-touch
```

2. 使用 组件:

``` javascript
import React from 'react';
import ReactDOM from 'react-dom';
import {
Button,
} from 'amazeui-touch';

class App extends React.Component {
constructor(props) {
this.state = {
said: false,
};
}

handleClick() {
this.setState({
said: true,
});
}

renderHello() {
return this.state.said ? (
<p>Hello World! Welcome to Amaze UI Touch.</p>
) : null;
}

render() {
const said = this.state.said;
const text = said ? 'Said :(' : 'Say hello :)';

return (
<div>
<Button disabled={said}>{text}</Button>
{this.renderHello()}
</div>
);
}
});

ReactDOM.render(<App />, document.getElementById('root'));
```
``` javascript
class App extends React.Component {
constructor(props) {
super(props);
this.state = {
said: false,
};
this.handleClick = this.handleClick.bind(this);
}
handleClick() {
this.setState({
said: true,
});
}
renderHello() {
return this.state.said ? (
<p>Hello World! Welcome to Amaze UI Touch.</p>
) : null;
}
render() {
const said = this.state.said;
const text = said ? 'Said :(' : 'Say hello :)';
return (
<div>
<Button
amStyle="primary"
disabled={said}
onClick={this.handleClick}
>
{text}
</Button>
{this.renderHello()}
</div>
);
}
}
ReactDOM.render(<App />, document.getElementById('root'));
```

ES2015/JSX 编译参见 [Amaze UI Touch Starter Kit](https://github.com/amazeui/amt-starter-kit)。

Expand Down

0 comments on commit 286b9d9

Please sign in to comment.