mirror of
https://github.com/kuaifan/dootask.git
synced 2026-01-20 16:08:14 +00:00
feat: 支持输入法组合状态,优化输入框键盘事件处理
This commit is contained in:
parent
dd20711c04
commit
224703a6d0
@ -99,7 +99,9 @@
|
||||
:rows="inputRows || 1"
|
||||
:autosize="inputAutosize || {minRows:1, maxRows:6}"
|
||||
:maxlength="inputMaxlength || 500"
|
||||
@on-keydown="onInputKeydown" />
|
||||
@on-keydown="onInputKeydown"
|
||||
@compositionstart.native="isComposing = true"
|
||||
@compositionend.native="isComposing = false" />
|
||||
<div class="ai-assistant-footer">
|
||||
<div class="ai-assistant-footer-models">
|
||||
<Select
|
||||
@ -176,6 +178,9 @@ export default {
|
||||
modelCacheKey: 'aiAssistant.model',
|
||||
cachedModelId: '',
|
||||
|
||||
// 输入法组合状态
|
||||
isComposing: false,
|
||||
|
||||
// 响应渲染
|
||||
responses: [],
|
||||
responseSeed: 1,
|
||||
@ -405,9 +410,10 @@ export default {
|
||||
|
||||
/**
|
||||
* 输入框键盘事件:回车发送,Shift+回车换行
|
||||
* 注意:输入法组合输入时(如中文候选字)不发送
|
||||
*/
|
||||
onInputKeydown(e) {
|
||||
if (e.key === 'Enter' && !e.shiftKey) {
|
||||
if (e.key === 'Enter' && !e.shiftKey && !this.isComposing) {
|
||||
e.preventDefault();
|
||||
this.onSubmit();
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user