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