mirror of
https://github.com/kuaifan/dootask.git
synced 2026-02-24 18:30:28 +00:00
feat: 支持 AI 助手输入框回车快捷操作
- 新增 onInputKeydown 方法:支持回车发送、Shift+Enter 换行,提升输入体验。 - 更新输入框组件,绑定键盘事件,实现更流畅的交互。 - 自动聚焦输入框,提升用户体验。
This commit is contained in:
parent
1af29837e2
commit
0362c83e77
@ -93,11 +93,13 @@
|
|||||||
<div class="ai-assistant-input">
|
<div class="ai-assistant-input">
|
||||||
<Input
|
<Input
|
||||||
v-model="inputValue"
|
v-model="inputValue"
|
||||||
|
ref="inputRef"
|
||||||
type="textarea"
|
type="textarea"
|
||||||
:placeholder="inputPlaceholder || $L('请输入你的问题...')"
|
:placeholder="inputPlaceholder || $L('请输入你的问题...')"
|
||||||
:rows="inputRows || 1"
|
:rows="inputRows || 1"
|
||||||
:autosize="inputAutosize || {minRows:1, maxRows:6}"
|
:autosize="inputAutosize || {minRows:1, maxRows:6}"
|
||||||
:maxlength="inputMaxlength || 500" />
|
:maxlength="inputMaxlength || 500"
|
||||||
|
@on-keydown="onInputKeydown" />
|
||||||
<div class="ai-assistant-footer">
|
<div class="ai-assistant-footer">
|
||||||
<div class="ai-assistant-footer-models">
|
<div class="ai-assistant-footer-models">
|
||||||
<Select
|
<Select
|
||||||
@ -252,6 +254,7 @@ export default {
|
|||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
this.scheduleAutoSubmit();
|
this.scheduleAutoSubmit();
|
||||||
this.scrollResponsesToBottom();
|
this.scrollResponsesToBottom();
|
||||||
|
this.$refs.inputRef.focus();
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -400,6 +403,16 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 输入框键盘事件:回车发送,Shift+回车换行
|
||||||
|
*/
|
||||||
|
onInputKeydown(e) {
|
||||||
|
if (e.key === 'Enter' && !e.shiftKey) {
|
||||||
|
e.preventDefault();
|
||||||
|
this.onSubmit();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 发送提问并推入响应
|
* 发送提问并推入响应
|
||||||
*/
|
*/
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user