From 6a1e7278fa192effa3aac409dabeb8fc34175f91 Mon Sep 17 00:00:00 2001 From: afc163 Date: Thu, 19 May 2016 15:36:35 +0800 Subject: [PATCH] Fix combobox Select optionLabelProp, close #1773 --- components/select/index.jsx | 5 ++--- components/select/index.md | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/components/select/index.jsx b/components/select/index.jsx index cdf35d53bc..ceb0ec2686 100644 --- a/components/select/index.jsx +++ b/components/select/index.jsx @@ -9,7 +9,6 @@ export default class Select extends React.Component { static defaultProps = { prefixCls: 'ant-select', transitionName: 'slide-up', - optionLabelProp: 'children', choiceTransitionName: 'zoom', showSearch: false, } @@ -38,13 +37,13 @@ export default class Select extends React.Component { if (combobox) { notFoundContent = null; // children 带 dom 结构时,无法填入输入框 - optionLabelProp = 'value'; + optionLabelProp = optionLabelProp || 'value'; } return ( ); } diff --git a/components/select/index.md b/components/select/index.md index 8d78603e15..a08200bd31 100644 --- a/components/select/index.md +++ b/components/select/index.md @@ -37,7 +37,7 @@ english: Select | notFoundContent | 当下拉列表为空时显示的内容 | string | 'Not Found' | | dropdownMatchSelectWidth | 下拉菜单和选择器同宽 | boolean | true | | optionFilterProp | 搜索时过滤对应的 option 属性,如设置为 children 表示对内嵌内容进行搜索 | string | value | -| optionLabelProp | 回填到选择框的 Option 的属性值,默认是 Option 的子元素。比如在子元素需要高亮效果时,此值可以设为 `value`。 | string | `children` | +| optionLabelProp | 回填到选择框的 Option 的属性值,默认是 Option 的子元素。比如在子元素需要高亮效果时,此值可以设为 `value`。 | string | `children` (combobox 模式下为 `value`) | | combobox | 输入框自动提示模式 | boolean | false | | size | 选择框大小,可选 `large` `small` | String | default | | showSearch | 在选择框中显示搜索框 | boolean | false |