Skip to content

PromptInput 提示词输入 ​

会话输入框:多行自增高、Enter 提交、Shift+Enter 换行、建议项、发送/停止态、附件与页脚插槽。

基础用法 ​

输入消息 + 建议项(点击建议回填;Enter 提交)

生成中 / 禁用 ​

loading 期间宿主反射 aria-busy="true",发送钮切换为「停止」并派发 oas-stop;readonly 只限制编辑,不阻止停止命令。

loading:发送钮切换为停止;disabled:不可输入/提交

只读 / 长度 / 初始行数 / 提交策略

插槽 ​

prefix / actions / footer 插槽

附件模板Enter 发送 · Shift+Enter 换行

API ​

oas-prompt-input ​

属性 ​

属性说明类型默认值
clear-on-submit提交后清空(默认 true)stringtrue
disabled禁用输入与提交boolean—
loading生成中;发送钮切换为停止boolean—
maxlength最大字符数string—
placeholder占位文案(缺省 i18n promptInput.placeholder)string—
readonly只读(可聚焦/复制,不可修改)boolean—
rows初始行数(1+,自增高上限 160px)string1
submit-on-enterEnter 提交(默认 true;false 时仅按钮提交,Shift+Enter 始终换行)stringtrue
suggestions建议项 JSON:字符串或 { label?, value } 数组string—
value当前文本(property 双通道;attribute 作为初始值)string—

Property(JS property;是否写回 attribute 见各行说明) ​

Property说明类型默认值
value当前文本(读写)string—

方法 ​

方法签名说明
submitsubmit(): boolean提交当前文本;空值/禁用/loading 返回 false
stopstop(): void停止生成(仅 loading 时派发 oas-stop)
focusInputfocusInput(): void聚焦内部 textarea

事件 ​

事件说明
oas-stoploading 时点击停止派发,detail: {}
oas-submit提交时派发,detail:
oas-suggestion-select点击建议项时派发,detail:

插槽 ​

名称说明
actions发送钮前的操作区
footer输入框底部说明/工具行
prefix输入框前置内容

基于 MIT OR Apache-2.0 双许可发布