Skip to content

Commit 5cc603d

Browse files
committed
doc: remove optionLabelProp, close #5212
1 parent 53fa277 commit 5cc603d

File tree

4 files changed

+67
-3
lines changed

4 files changed

+67
-3
lines changed

components/auto-complete/index.en-US.md

+28-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ When there is a need for autocomplete functionality.
3131
| disabled | Whether disabled select | boolean | false | |
3232
| dropdownMatchSelectWidth | Determine whether the dropdown menu and the select input are the same width. Default set `min-width` same as input. Will ignore when value less than select width. `false` will disable virtual scroll | boolean \| number | true | |
3333
| filterOption | If true, filter options by input, if function, filter options against it. The function will receive two arguments, `inputValue` and `option`, if the function returns `true`, the option will be included in the filtered set; Otherwise, it will be excluded. | boolean or function(inputValue, option) | true | |
34-
| optionLabelProp | Which prop value of option will render as content of select. | string | `children` | |
3534
| placeholder | placeholder of input | string | - | |
3635
| v-model:value | selected option | string\|string\[]\|{ key: string, label: string\|vNodes }\|Array<{ key: string, label: string\|vNodes }> | - | |
3736
| defaultOpen | Initial open state of dropdown | boolean | - | |
@@ -54,3 +53,31 @@ When there is a need for autocomplete functionality.
5453
| ------- | ------------ | ------- |
5554
| blur() | remove focus | |
5655
| focus() | get focus | |
56+
57+
## FAQ
58+
59+
### Part of the api in v2 are not available in v3?
60+
61+
AutoComplete is an Input component that supports auto complete tips. As such, it should not support props like `labelInValue` that affect value display. In v2, the AutoComplete implementation can not handle the case where the `value` and `label` are identical. v3 not longer support `label` as the value input.
62+
63+
Besides, to unify the API, `dataSource` is replaced with `options`. You can migrate with the following change:
64+
65+
#### v2
66+
67+
```ts
68+
dataSource = ['light', 'bamboo'];
69+
// or
70+
dataSource = [
71+
{ value: 'light', text: 'Light' },
72+
{ value: 'bamboo', text: 'Bamboo' },
73+
];
74+
```
75+
76+
#### v3
77+
78+
```ts
79+
options = [
80+
{ value: 'light', label: 'Light' },
81+
{ value: 'bamboo', label: 'Bamboo' },
82+
];
83+
```

components/auto-complete/index.zh-CN.md

+28-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ cover: https://gw.alipayobjects.com/zos/alicdn/qtJm4yt45/AutoComplete.svg
3838
| disabled | 是否禁用 | boolean | false | |
3939
| dropdownMatchSelectWidth | 下拉菜单和选择器同宽。默认将设置 `min-width`,当值小于选择框宽度时会被忽略。false 时会关闭虚拟滚动 | boolean \| number | true | |
4040
| filterOption | 是否根据输入项进行筛选。当其为一个函数时,会接收 `inputValue` `option` 两个参数,当 `option` 符合筛选条件时,应返回 `true`,反之则返回 `false`| boolean or function(inputValue, option) | true | |
41-
| optionLabelProp | 回填到选择框的 Option 的属性值,默认是 Option 的子元素。比如在子元素需要高亮效果时,此值可以设为 `value`| string | `children` | |
4241
| placeholder | 输入框提示 | string \| slot | - | |
4342
| v-model:value | 指定当前选中的条目 | string\|string\[]\|{ key: string, label: string\|vNodes }\|Array<{ key: string, label: string\|vNodes }> || |
4443
| defaultOpen | 是否默认展开下拉菜单 | boolean | - | |
@@ -61,3 +60,31 @@ cover: https://gw.alipayobjects.com/zos/alicdn/qtJm4yt45/AutoComplete.svg
6160
| ------- | -------- | ---- |
6261
| blur() | 移除焦点 |
6362
| focus() | 获取焦点 |
63+
64+
## FAQ
65+
66+
### v2 的部分属性为何在 v3 中没有了?
67+
68+
AutoComplete 组件是一个支持自动提示的 Input 组件,因而其不具有 `labelInValue` 等影响 value 展示的属性。在 v2 版本,AutoComplete 实现存在输入值如果遇到 `value``label` 相同时无法映射的问题。 v3 中不再支持 `label` 为值的输入形态。
69+
70+
此外为了统一 API,`dataSource` 改为 `options` 你可以如下转换:
71+
72+
#### v2
73+
74+
```ts
75+
dataSource = ['light', 'bamboo'];
76+
// or
77+
dataSource = [
78+
{ value: 'light', text: 'Light' },
79+
{ value: 'bamboo', text: 'Bamboo' },
80+
];
81+
```
82+
83+
#### v3
84+
85+
```ts
86+
options = [
87+
{ value: 'light', label: 'Light' },
88+
{ value: 'bamboo', label: 'Bamboo' },
89+
];
90+
```

site/src/vueDocs/migration-v3.en-US.md

+5
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,11 @@ Major updates after the 3.0 version refactoring include `Tree` `TreeSelect` `Dat
4141
- Added virtual scrolling, discarded using `a-tree-node` `a-tree-select-node` to build nodes, using `treeData` property instead to improve component performance.
4242
- Deprecated `scopedSlots` `slots` custom rendering node, and replace it with `v-slot:title` to improve ease of use, avoid slot configuration expansion, and also avoid slot conflicts.
4343

44+
- `AutoComplete`
45+
46+
- no longer support `optionLabelProp`. Please set Option `value` directly.
47+
- options definition align with Select. Please use `options` instead of `dataSource`.
48+
4449
- `Table`
4550

4651
- Removed the `rowSelection.hideDefaultSelections` property of Table, please use `SELECTION_ALL` and `SELECTION_INVERT` in `rowSelection.selections` instead, [custom options](/components/table/#components-table-demo- row-selection-custom).

site/src/vueDocs/migration-v3.zh-CN.md

+6-1
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,18 @@
3535

3636
为了让组件拥有更好的性能和可维护性,我们几乎使用 TS + Composition Api 重构了所有组件,目前还有极个别的组件没有重构,这类组件会在接下来逐步重构,剩余的组件不会有破坏性更新,所以不用担心未来的升级成本。
3737

38-
3.0 版本重构后较大的更新有 `Tree` `TreeSelect` `DatePicker` `TimePicker` `Calendar` `Form` `Table`,其它组件也有相应功能的更新,你可以查看 ChangeLog 进一步了解详情。
38+
3.0 版本重构后较大的更新有 `Tree` `TreeSelect` `DatePicker` `TimePicker` `Calendar` `Form` `Table` `AutoComplete`,其它组件也有相应功能的更新,你可以查看 ChangeLog 进一步了解详情。
3939

4040
- `Tree` `TreeSelect`
4141

4242
- 新增了虚拟滚动,废弃使用 `a-tree-node` `a-tree-select-node` 构建节点,使用 `treeData` 属性替代,提升组件性能。
4343
- 废弃 `scopedSlots` `slots` 自定义渲染节点,使用 `v-slot:title` 替换,提升易用性,避免插槽配置膨胀,同时也避免了插槽冲突问题。
4444

45+
- `AutoComplete`
46+
47+
- 不再支持 `optionLabelProp`,请直接设置 Option `value` 属性。
48+
- 选项与 Select 对齐,请使用 `options` 代替 `dataSource`
49+
4550
- `Table`
4651

4752
- 移除了 Table 的 `rowSelection.hideDefaultSelections` 属性,请在 `rowSelection.selections` 中使用 `SELECTION_ALL``SELECTION_INVERT` 替代,[自定义选择项](/components/table/#components-table-demo-row-selection-custom)

0 commit comments

Comments
 (0)