Skip to content

输入框

用于 AI 聊天的输入框,可进行能力扩展

image

安装方式

bash
yarn add pangea-component

引用方式

js
import HiSender from "pangea-component/hi-sender";
import "pangea-component/dist/style.css";

API

Props

参数名描述类型默认值
value输入框的值string-
placeholder输入框占位文字string-
disabled是否禁用输入框booleanfalse
loading是否发送中booleanfalse
max最大输入字数number-
allowSpeech是否允许语音输入booleanfalse
allowUpload是否允许附件上传booleanfalse
minRow显示最小行数number1
maxRow显示最大行数number5

Events

方法名描述参数
change输入内容变化时触发的事件(value: string) => void
send发送时触发的事件(value: string) => void
stop取消发送触发事件() => void

Slot

插槽名描述参数
top输入框顶部插槽-
prefix输入框底部左侧扩展插槽-
suffix输入框底部右侧扩展-

使用示例

html
<template>
  <hi-sender 
    :value="inputValue" 
    placeholder="发送消息" 
    @change="changeValue"
    @send="send" 
    @stop="stop">
  </hi-sender>
</template>
<script lang="ts" setup>
import { ref } from "vue";
import HiSender from "pangea-component/hi-sender";

const inputValue = ref("")

const changeValue = (value) => {
  inputValue.value = value;
}

const send = (value) => {
  console.log("value", value)
};

const stop = () => {
};
</script>