From 014a70ce8ed64194c84d8c3a500522b956e6b8fe Mon Sep 17 00:00:00 2001 From: haohao_peng Date: Tue, 30 Jul 2024 20:05:32 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20[select]=20=E6=96=B0=E5=A2=9E=E5=9B=BD?= =?UTF-8?q?=E9=99=85=E5=8C=96=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/config-provider/compDefaultProps.tsx | 1 - components/locale/zh-CN.tsx | 6 ++++-- components/select/select.tsx | 7 ++++--- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/components/config-provider/compDefaultProps.tsx b/components/config-provider/compDefaultProps.tsx index 91c69569..e5254df2 100644 --- a/components/config-provider/compDefaultProps.tsx +++ b/components/config-provider/compDefaultProps.tsx @@ -149,7 +149,6 @@ const compDefaultProps = { mode: 'single', defaultOpen: false, showArrow: true, - placeholder: '请输入需要搜索的内容', filterOption: true, optionLabelProp: 'children', optionFilterProp: 'label', diff --git a/components/locale/zh-CN.tsx b/components/locale/zh-CN.tsx index 643ab837..cb466320 100644 --- a/components/locale/zh-CN.tsx +++ b/components/locale/zh-CN.tsx @@ -4,9 +4,10 @@ const locale = { locale: 'zh-CN', ...DatePicker, 'global.selectholder': '请选择', - 'global.placeholder': '请输入...', + 'global.placeholder': '请输入需要搜索的内容', 'global.cancel': '取消', 'global.confirm': '确定', + 'global.emptyText': '暂无数据', 'Button.text': '按钮', 'Progress.circleLoadingDesc': '正在加载中', 'Progress.loading': '正在加载中...', @@ -78,6 +79,7 @@ const locale = { 'Table.confirmFilter': '确定', 'Select.selectAll': '全选', 'Select.seleted': '已选{size}项', + 'Select.total': '共{total}项', 'Signature.clickToSign': '点击签名', 'Signature.pleaseWriteHere': '请在此处横向书写签名', 'Signature.okText': '确定', @@ -91,7 +93,7 @@ const locale = { 'Upload.uploading': '文件上传中ing', 'Upload.fail': '上传失败', 'Upload.delete': '删除', - 'Notification.title': '系统提示11', + 'Notification.title': '系统提示', } export default locale diff --git a/components/select/select.tsx b/components/select/select.tsx index abb72db6..516cc0bd 100755 --- a/components/select/select.tsx +++ b/components/select/select.tsx @@ -50,7 +50,7 @@ const InternalSelect: React.ForwardRefRenderFunction> labelInValue, children, options, - placeholder, + placeholder = locale.getLangMsg('global', 'placeholder'), dropdownStyle = {}, style, clearIcon, @@ -541,7 +541,7 @@ const InternalSelect: React.ForwardRefRenderFunction> [`${selectPrefixCls}-dropdown-empty`]: true, }) const { notFoundContent } = selectProps - const emptyContent = notFoundContent || '暂无数据' + const emptyContent = notFoundContent || locale.getLangMsg('global', 'emptyText') return filledOptions?.length === 0 &&
{emptyContent}
} @@ -716,6 +716,7 @@ const InternalSelect: React.ForwardRefRenderFunction> [`${selectPrefixCls}-selection-item-${size}`]: size, }) const TagStyle = { margin: '2px 8px 2px 0', maxWidth: '100%' } + const totalText = locale.getLangMsg('Select', 'total', { total: mulOptions.length }) return (
{Array.isArray(mulOptions) ? ( @@ -751,7 +752,7 @@ const InternalSelect: React.ForwardRefRenderFunction> handleMaxTagHolder() ) : ( - 共{mulOptions.length}项 + {totalText} ) ) : null}