Input

Input 输入框

代码示例

import { BfInput } from '@bud-fe/react-taro-ui';
import { View } from '@tarojs/components';
import React from 'react';
import './index.module.less';
export default () => {
return (
<>
<View className="group-title">基础用法</View>
<BfInput
maxlength={50}
required
label="标题"
placeholder="请输入"
onChange={(v) => {
console.log('onChange', v);
}}
/>
<View className="group-title">type=number; min=5</View>
<BfInput
required
type="number"
min={5}
label="标题"
placeholder="请输入"
onChange={(v) => {
console.log('onChange', v);
}}
/>
<View className="group-title">禁用模式-支持禁用样式覆写</View>
<BfInput disableDebounce maxlength={50} required label="标题" placeholder="请输入" value="禁用" disabled />
</>
);
};

API

属性名描述类型默认值
className自定义样式string--
required是否必填boolean--
bordered边框booleantrue
label标题文案string--
disableDebounce禁用防抖功能booleanfalse
min最小值。仅 type=number 时有效number--
max最大值。仅 type=number 时有效number--
onChange输入回调。默认 500ms 的防抖(value: any) => void--
enableNative支付宝/钉钉小程序专属propsbooleanfalse
formKey数据 keystring--
verifyFunc校验方法IVerifyFunction--
addVerify添加验证组件(formKey: string, func: IVerifyFunction) => void--
changeFormData组件数据改变(formKey: string, value: any) => void--
formData验证数据Record<string, any>--
verifyList组件验证列表Record<string, IVerifyFunction>--
dumi10:24