diff --git a/components/cascader/demo/suffix.md b/components/cascader/demo/suffix.md index 3955444a1533..c759aac853a7 100644 --- a/components/cascader/demo/suffix.md +++ b/components/cascader/demo/suffix.md @@ -48,13 +48,13 @@ function onChange(value) { ReactDOM.render(
} + suffixIcon={} options={options} onChange={onChange} placeholder="Please select" /> void` | - | | onPopupVisibleChange | callback when popup shown or hidden | `(value) => void` | - | diff --git a/components/cascader/index.tsx b/components/cascader/index.tsx index 61502d0247a2..92c413174e6d 100644 --- a/components/cascader/index.tsx +++ b/components/cascader/index.tsx @@ -83,7 +83,7 @@ export interface CascaderProps { getPopupContainer?: (triggerNode?: HTMLElement) => HTMLElement; popupVisible?: boolean; fieldNames?: FieldNamesType; - suffix?: React.ReactNode; + suffixIcon?: React.ReactNode; } export interface CascaderState { @@ -342,7 +342,7 @@ export default class Cascader extends React.Component(suffix) + const inputIcon = suffixIcon && ( + React.isValidElement<{ className?: string }>(suffixIcon) ? React.cloneElement( - suffix, + suffixIcon, { className: classNames({ - [suffix.props.className!]: suffix.props.className, + [suffixIcon.props.className!]: suffixIcon.props.className, [`${prefixCls}-picker-arrow`]: true, }), }, - ) : {suffix}) || ( + ) : {suffixIcon}) || ( ); diff --git a/components/cascader/index.zh-CN.md b/components/cascader/index.zh-CN.md index 9e030c72df2b..60a02c8e2833 100644 --- a/components/cascader/index.zh-CN.md +++ b/components/cascader/index.zh-CN.md @@ -41,7 +41,7 @@ subtitle: 级联选择 | showSearch | 在选择框中显示搜索框 | boolean | false | | size | 输入框大小,可选 `large` `default` `small` | string | `default` | | style | 自定义样式 | string | - | -| suffix | 自定义的选择框后缀图标 | ReactNode | - | +| suffixIcon | 自定义的选择框后缀图标 | ReactNode | - | | value | 指定选中项 | string\[] | - | | onChange | 选择完成后的回调 | `(value, selectedOptions) => void` | - | | onPopupVisibleChange | 显示/隐藏浮层的回调 | `(value) => void` | - |