输入框 Input
自研输入框,原生 <input> 实现,支持清除按钮。
Props
| 属性 | 类型 | 默认值 | 说明 |
|---|---|---|---|
modelValue | string | number | '' | 绑定值(v-model) |
placeholder | string | '' | 占位提示 |
type | string | 'text' | 输入框类型(text/password/number 等) |
disabled | boolean | false | 是否禁用 |
clearable | boolean | false | 是否显示一键清除按钮 |
事件
| 事件 | 参数 | 说明 |
|---|---|---|
update:modelValue | string | 输入/清除时触发 |
示例
vue
<template>
<Input v-model="keyword" placeholder="请输入关键词" clearable />
<Input v-model="password" type="password" placeholder="密码" />
<Input v-model="name" disabled />
</template>