UNPKG

@ray-js/smart-ui-typings

Version:

@ray-js/smart-ui 智能小程序 UI 框架的类型声明文件

167 lines (166 loc) 3.69 kB
/// <reference types="wechat-miniprogram" /> import { VantBaseExternalClassName, VantComponent, VantEventHandler } from '../base'; import { VantFieldEvents } from '../field'; export interface VantSearchProps { /** * 在表单内提交时的标识符 */ name?: string; /** * 搜索框左侧文本 */ label?: string; /** * 形状 * * @default 'square' */ shape?: 'round' | 'square'; /** * 当前输入的值 */ value?: string | number; /** * 搜索框背景色 * * @default '#f2f2f2' */ background?: string; /** * 是否在搜索框右侧显示取消按钮 * * @default false */ showAction?: boolean; /** * @version v1.0.0 * * @default '取消' */ actionText: string; /** * 获取焦点 * * @default false */ focus?: boolean; /** * 是否将输入内容标红 * * @default false */ error?: boolean; /** * 是否禁用输入框 * * @default false */ disabled?: boolean; /** * 是否只读 * * @default false */ readonly?: boolean; /** * 是否启用清除控件 * * @default true */ clearable?: boolean; /** * 显示清除图标的时机,`always`表示输入框不为空时展示, * `focus`表示输入框聚焦且不为空时展示 * @version `v1.8.4` * * @default 'focus' */ clearTrigger?: 'always' | 'focus'; /** * 清除图标名称或图片链接 * * @version `v1.8.4` * * @default 'clear' */ clearIcon?: string; /** * 最大输入长度,设置为`-1`的时候不限制最大长度 * * @default -1 */ maxlength?: number; /** * 是否使用 `action slot` * * @default false */ useActionSlot?: boolean; /** * 输入框为空时占位符 */ placeholder?: string; /** * 指定占位符的样式 */ placeholderStyle?: string; /** * 输入框内容对齐方式 * * @default 'left' */ inputAlign?: 'left' | 'center' | 'right'; /** * 是否使用输入框左侧图标 `slot` * * @default false */ useLeftIconSlot?: boolean; /** * 是否使用输入框右侧图标`slot` * * @default false */ useRightIconSlot?: boolean; /** * 输入框左侧图标名称或图片链接,可选值见`Icon`组件(如果设置了`use-left-icon-slot`,则该属性无效) * * @default 'search' */ leftIcon?: string; /** * 输入框右侧图标名称或图片链接,可选值见`Icon`组件(如果设置了`use-right-icon-slot`,则该属性无效) */ rightIcon?: string; } /** * @deprecated */ export interface VantSearchBaseEvent extends WechatMiniprogram.BaseEvent { detail: string; } export interface VantSearchEvents extends Pick<VantFieldEvents, 'onChange' | 'onFocus' | 'onBlur' | 'onClear' | 'onClickInput'> { /** * 确定搜索时触发 */ onSearch?: VantEventHandler<string>; /** * 取消搜索搜索时触发 */ onCancel?: VantEventHandler; } export interface VantSearchExternalClassName extends VantBaseExternalClassName { /** * 搜索框样式类 */ fieldClass?: string; /** * 输入框样式类 */ inputClass?: string; /** * 取消按钮样式类 */ cancelClass?: string; } export type VantSearch = VantComponent<VantSearchProps, VantSearchEvents, VantSearchExternalClassName>;