Skip to content

Input 输入框 ​

通过鼠标或键盘输入字符。

基础用法 ​

输入值: (空)
vue
<my-input v-model="value" placeholder="请输入内容" />

不同类型 ​

vue
<my-input type="text" placeholder="文本" />
<my-input type="password" placeholder="密码" show-password />
<my-input type="email" placeholder="邮箱" />

可清空 ​

vue
<my-input v-model="value" clearable />

组件结构 ​

根元素 <div class="my-input"> 按顺序包含:前置插槽 __prepend、内部包裹容器 __inner-wrap(内有前缀 __prefix、<input> 或 <textarea> 元素 __inner、后缀 __suffix)、后置插槽 __append。

CSS 类名 ​

类名说明
.my-input根元素
.my-input--textarea文本域模式
.my-input--prepend有前置内容
.is-large大尺寸
.is-small小尺寸
.is-disabled禁用状态
.is-readonly只读状态
.my-input__inner-wrap输入框内部包裹容器
.my-input__inner原生 input/textarea 元素
.my-input__prepend前置内容区
.my-input__append后置内容区
.my-input__prefix输入框内前缀
.my-input__suffix输入框内后缀
.my-input__clear清空按钮
.my-input__password-toggle密码可见切换按钮

API ​

属性说明类型默认值
modelValue绑定值string | number—
type输入框类型'text' | 'password' | 'textarea' | 'email' | 'tel' | 'url''text'
placeholder占位文字string—
disabled是否禁用booleanfalse
clearable是否可清空booleanfalse
showPassword是否显示密码booleanfalse
插槽说明
prepend前置内容
append后置内容
prefix前缀
suffix后缀