diff --git a/src/rate/Rate.tsx b/src/rate/Rate.tsx index 3e3a36eb1..50be96cf8 100644 --- a/src/rate/Rate.tsx +++ b/src/rate/Rate.tsx @@ -36,7 +36,7 @@ const Rate = React.forwardRef((originalProps, ref) => const { allowHalf, color, count, disabled, gap, showText, size, icon, className, style, onChange, texts } = props; const [locale, t] = useLocaleReceiver('rate'); - const displayTexts = texts || t(locale.rateText); + const displayTexts = texts.length ? texts : t(locale.rateText); const { classPrefix } = useConfig(); const [starValue = 0, setStarValue] = useControlled(props, 'value', onChange); diff --git a/test/snap/__snapshots__/csr.test.jsx.snap b/test/snap/__snapshots__/csr.test.jsx.snap index 9e63e24a6..7431269f6 100644 --- a/test/snap/__snapshots__/csr.test.jsx.snap +++ b/test/snap/__snapshots__/csr.test.jsx.snap @@ -72962,7 +72962,9 @@ exports[`csr snapshot test > csr test src/rate/_example/texts.tsx 1`] = `
+ > + satisfied +
`; @@ -133809,7 +133811,7 @@ exports[`ssr snapshot test > ssr test src/rate/_example/size.tsx 1`] = `"
ssr test src/rate/_example/status.tsx 1`] = `"

未评分状态

满分状态

半星状态

"`; -exports[`ssr snapshot test > ssr test src/rate/_example/texts.tsx 1`] = `"
"`; +exports[`ssr snapshot test > ssr test src/rate/_example/texts.tsx 1`] = `"
satisfied
"`; exports[`ssr snapshot test > ssr test src/select/_example/base.tsx 1`] = `"
"`; diff --git a/test/snap/__snapshots__/ssr.test.jsx.snap b/test/snap/__snapshots__/ssr.test.jsx.snap index 46dfc2bbe..5ab5e4bd1 100644 --- a/test/snap/__snapshots__/ssr.test.jsx.snap +++ b/test/snap/__snapshots__/ssr.test.jsx.snap @@ -760,7 +760,7 @@ exports[`ssr snapshot test > ssr test src/rate/_example/size.tsx 1`] = `"
ssr test src/rate/_example/status.tsx 1`] = `"

未评分状态

满分状态

半星状态

"`; -exports[`ssr snapshot test > ssr test src/rate/_example/texts.tsx 1`] = `"
"`; +exports[`ssr snapshot test > ssr test src/rate/_example/texts.tsx 1`] = `"
satisfied
"`; exports[`ssr snapshot test > ssr test src/select/_example/base.tsx 1`] = `"
"`;