import React from "react"; import classNames from "classnames"; import { useTranslation } from "../i18n"; import { StyledProps } from "../_type"; import { useConfig } from "../_util/config-context"; export interface FoundTipProps extends StyledProps { /** * 找到结果的文案 * @default "找到下列结果" */ foundText?: React.ReactNode; /** * 清空结果提示文案 * @default "返回原列表" */ clearResultText?: React.ReactNode; /** * 返回原列表时回调,如果不传则不渲染此操作 */ onClear?: () => void; } export const FoundTip = React.forwardRef(function FoundTip( props: FoundTipProps, ref: React.Ref ) { const { classPrefix } = useConfig(); const t = useTranslation(); const { foundText = t.foundText, clearResultText = t.clearResultText, onClear, className, ...restProps } = props; return ( {typeof foundText === "string" ? ( {foundText} ) : ( foundText )} {onClear && ( <> {" "} {clearResultText} )} ); }); FoundTip.displayName = "FoundTip";