mirror of
https://github.com/ant-design/ant-design.git
synced 2024-11-29 13:47:02 +08:00
Merge branch 'develop-1.0.0' of github.com:ant-design/ant-design into develop-1.0.0
This commit is contained in:
commit
80f11f5f70
@ -132,7 +132,10 @@ let Demo = React.createClass({
|
||||
rules: [
|
||||
{ required: true, whitespace: true, message: '请填写密码' },
|
||||
{ validator: this.checkPass }
|
||||
]
|
||||
],
|
||||
onChange: (e) => {
|
||||
console.log('你的密码就是这样被盗的:', e.target.value);
|
||||
},
|
||||
});
|
||||
const rePassProps = getFieldProps('rePass', {
|
||||
rules: [{
|
||||
|
@ -81,7 +81,7 @@ CustomizedForm = Form.create({})(CustomizedForm);
|
||||
| getFieldError | 获取某个输入控件的 Error | Function(name) | | |
|
||||
| isFieldValidating | 判断一个输入控件是否在校验状态 | Function(name) | | |
|
||||
| resetFields | 重置一组输入控件的值与状态,如不传入参数,则重置所有组件 | Function([names: string[]]) | | |
|
||||
| getFieldProps | 用于和表单进行双向绑定,详见下方描述 | | | |
|
||||
| getFieldProps | 用于和表单进行双向绑定,详见下方描述 | | | | |
|
||||
|
||||
#### this.props.form.getFieldProps(id, options)
|
||||
|
||||
@ -94,7 +94,8 @@ CustomizedForm = Form.create({})(CustomizedForm);
|
||||
| options.initialValue | 子节点的初始值,类型、可选值均由子节点决定 | | | |
|
||||
| options.trigger | 收集子节点的值的时机 | string | | 'onChange' |
|
||||
| options.validateTrigger | 校验子节点值的时机 | string | | 'onChange' |
|
||||
| options.rules | 校验规则,参见 [async-validator](https://github.com/yiminghe/async-validator) | array | | | |
|
||||
| options.rules | 校验规则,参见 [async-validator](https://github.com/yiminghe/async-validator) | array | | |
|
||||
| options.onXXX | 由于 `getFieldProps` 会占用 `onChange` 等事件(即你所设置的 `trigger` `validateTrigger`),所以如果仍需绑定事件,请在 `options` 内设置 | function | | 无 |
|
||||
|
||||
|
||||
### Form.Item
|
||||
|
@ -28,7 +28,7 @@
|
||||
| defaultValue | 指定默认选中的条目 | string/Array<String> | 无 |
|
||||
| multiple | 支持多选 | boolean | false |
|
||||
| allowClear | 支持清除, 单选模式有效 | boolean | false |
|
||||
| filterOption | 是否根据输入项进行筛选,可为一个函数,返回满足要求的 option 即可 | boolean or function(inputValue, option) | true |
|
||||
| filterOption | 是否根据输入项进行筛选。当其为一个函数时,会接收 `inputValue` `option` 两个参数,当 `option` 符合筛选条件时,应返回 `true`,反之则返回 `false`。 | boolean or function(inputValue, option) | true |
|
||||
| tags | 可以把随意输入的条目作为 tag,输入项不需要与下拉选项匹配 | boolean |false |
|
||||
| onSelect | 被选中时调用,参数为选中项的 value 值 | function(value, option) | 无 |
|
||||
| onDeselect | 取消选中时调用,参数为选中项的 option value 值,仅在 multiple 或 tags 模式下生效 | function(value, option) | 无 |
|
||||
|
@ -46,6 +46,10 @@ export default class Header extends React.Component {
|
||||
this.props.history.push({ pathname: value });
|
||||
}
|
||||
|
||||
handleSelectFilter(value, option) {
|
||||
return option.props['data-label'].indexOf(value.toLowerCase()) > -1;
|
||||
}
|
||||
|
||||
render() {
|
||||
const routes = this.props.routes;
|
||||
const activeMenuItem = routes[1].path || 'home';
|
||||
@ -58,7 +62,7 @@ export default class Header extends React.Component {
|
||||
const pathSnippet = meta.fileName.split('/')[1];
|
||||
const url = `/components/${pathSnippet}`;
|
||||
return (
|
||||
<Option value={url} key={url} data-label={`${meta.english} {meta.chinese}`}>
|
||||
<Option value={url} key={url} data-label={`${meta.english.toLowerCase()} ${meta.chinese}`}>
|
||||
<strong>{meta.english}</strong>
|
||||
<span className="ant-component-decs">{meta.chinese}</span>
|
||||
</Option>
|
||||
@ -90,6 +94,7 @@ export default class Header extends React.Component {
|
||||
searchPlaceholder="搜索组件..."
|
||||
optionLabelProp="nothing"
|
||||
optionFilterProp="data-label"
|
||||
filterOption={this.handleSelectFilter.bind(this)}
|
||||
onSelect={this.handleSearch.bind(this)}>
|
||||
{options}
|
||||
</Select>
|
||||
|
Loading…
Reference in New Issue
Block a user