Skip to content

Input 输入框

通过鼠标或键盘输入字符的基础表单组件。

基础用法

可清空

使用 clearable 属性可以显示清空按钮。

密码框

使用 show-password 属性可以切换密码的显示与隐藏。

禁用和只读

通过 disabledreadonly 属性可以设置输入框的禁用和只读状态。

API

Props

参数说明类型可选值默认值
type输入框类型stringtext / password / numbertext
modelValue / v-model绑定值string | number--
placeholder占位文本string--
clearable是否可清空boolean-false
showPassword是否显示切换密码图标boolean-false
disabled是否禁用boolean-false
readonly是否只读boolean-false

Events

事件名说明回调参数
input输入时触发(value: string) => void
change值改变时触发(value: string) => void
focus获取焦点时触发(event: FocusEvent) => void
blur失去焦点时触发(event: FocusEvent) => void
clear点击清空按钮时触发() => void

Slots

插槽名说明
prepend输入框前置内容
append输入框后置内容
prefixIcon输入框头部图标
suffixIcon输入框尾部图标

使用示例

vue
<template>
  <AxInput v-model="value" placeholder="请输入" clearable />
</template>

<script setup>
import { ref } from 'vue'
import { AxInput } from '@axis-ui/components'

const value = ref('')
</script>

基于 MIT 协议开源