@cainiaofe/cn-ui-m
Version:
50 lines (49 loc) • 1.21 kB
TypeScript
import type { ReactNode } from 'react';
import type { BasicComponentProps } from "../../../types";
import type { CnInputProps } from "../../cn-input";
export interface CnSearchProps extends Pick<CnInputProps, 'onFocus' | 'onBlur' | 'onClear' | 'maxLength' | 'hasClear' | 'placeholder'>, Omit<BasicComponentProps, 'onFocus' | 'onBlur' | 'onChange'> {
/**
* 搜索框的值
*/
value?: string;
/**
* 搜索框的默认值
*/
defaultValue?: string;
/**
* 取消按钮的展示模式
*/
showCancelMode?: 'none' | 'focus' | 'always';
/**
* 取消按钮的文案
*/
cancelText?: string;
/**
* 点击取消时是否清空内容
*/
clearOnCancel?: boolean;
/**
* 展示确认按钮,确认按钮的优先级高于取消按钮
*/
showSearchButton?: boolean;
/**
* 搜索的图标
*/
icon?: ReactNode;
/**
* 搜索加载中
*/
loading?: boolean;
/**
* 搜索事件
*/
onSearch?: (val: string) => void;
/**
* 搜索框内容变更事件
*/
onChange?: (val: string) => void;
/**
* 取消事件
*/
onCancel?: () => void;
}