diff --git a/src/cascader/README.md b/src/cascader/README.md index cc9330993..754a6a7c7 100644 --- a/src/cascader/README.md +++ b/src/cascader/README.md @@ -192,13 +192,14 @@ export default { | --- | --- | --- | | change | Emitted when active option changed | `{ value, selectedOptions, tabIndex }` | | finish | Emitted when all options is selected | `{ value, selectedOptions, tabIndex }` | -| close | Emmitted when the close icon is clicked | - | +| close | Emitted when the close icon is clicked | - | ### Slots -| Name | Description | -| ----- | ------------ | -| title | Custom title | +| Name | Description | SlotProps | +| --- | --- | --- | +| title | Custom title | - | +| option `v2.12.25` | Custom option text | _{ option: Option, selected: boolean }_ | ### Less Variables diff --git a/src/cascader/README.zh-CN.md b/src/cascader/README.zh-CN.md index 7e4d8fbfc..31733f24a 100644 --- a/src/cascader/README.zh-CN.md +++ b/src/cascader/README.zh-CN.md @@ -210,9 +210,10 @@ export default { ### Slots -| 名称 | 说明 | -| ----- | -------------- | -| title | 自定义顶部标题 | +| 名称 | 说明 | 参数 | +| ----------------- | -------------- | --------------------------------------- | +| title | 自定义顶部标题 | - | +| option `v2.12.25` | 自定义选项文字 | _{ option: Option, selected: boolean }_ | ### 样式变量 diff --git a/src/cascader/index.js b/src/cascader/index.js index c288d44c5..7d497660d 100644 --- a/src/cascader/index.js +++ b/src/cascader/index.js @@ -200,6 +200,10 @@ export default createComponent({ selectedOption && option[this.valueKey] === selectedOption[this.valueKey]; + const Text = this.slots('option', { option, selected: isSelected }) || ( + {option[this.textKey]} + ); + return (
  • - {option[this.textKey]} + {Text} {isSelected ? ( ) : null}