前端悬浮输入组件

PopoverInput 是一个悬浮输入组件,通过弹出层的方式提供输入功能,适用于需要节省页面空间或临时输入的场景。

基础用法

import { defineAsyncComponent } from 'vue'

const PopoverInput = defineAsyncComponent(
  () => import("/@/components/PopoverInput/index.vue")
);

const onConfirm = (value: string) => {
  console.log('输入的值:', value);
};
<popover-input @confirm="onConfirm">
  <template #default>
    <el-button> 点击输入 </el-button>
  </template>
</popover-input>

属性说明

属性名称描述类型默认值
valueString-
type类型String'text'
width宽度Number | String'300px'
placeholder提示文字String-
disabled是否禁用Booleanfalse
options选项列表Array<any[]>[]
size大小'default' | 'small' | 'large''default'
limit字符限制Number200
showLimit是否显示字符限制Booleanfalse
teleported是否使用传送门(teleport)进行渲染Booleantrue

事件说明

事件名称说明回调参数
confirm确认输入时触发(value: string)