Skip to content

Commit

Permalink
Select clear selected example
Browse files Browse the repository at this point in the history
  • Loading branch information
Lobos committed Sep 14, 2015
1 parent 87860d6 commit cbd7ba4
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion docs/src/js/pages/select.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,16 @@

import React from 'react'
import prettify from '../prettify'
const {Select, dataSource} = global.uiRequire()
const {Select, dataSource, Button} = global.uiRequire()

@prettify
export default class Page extends React.Component {
static displayName = 'Pages/Select'

state = {
country: ''
}

render () {
return (
<div>
Expand Down Expand Up @@ -56,13 +60,18 @@ data 为简单数组(如["中国", "美国", "俄罗斯", "德国"]),时,所
filterAble={true}
optionTpl='<img src="images/flags/{code}.png" /> {country}-{en}'
valueTpl="{country}-{en}"
//onChange={ country => this.setState({ country }) }
value={this.state.country}
data={dataSource("json/countries.json")} />
<Button style={{ marginLeft: 10 }} onClick={ () => this.setState({ country: '' }) }>清空</Button>
<pre className="prettyprint">
{`<Select placeholder="单选"
filterAble={true}
optionTpl='<img src="images/flags/{code}.png" /> {country}-{en}'
valueTpl="{country}-{en}"
value={this.state.country}
data={dataSource("json/countries.json")} />
<Button style={{ marginLeft: 10 }} onClick={ () => this.setState({ country: '' }) }>清空</Button>
`}
</pre>

Expand Down

0 comments on commit cbd7ba4

Please sign in to comment.