对话框自动获取焦点

This commit is contained in:
kuaifan 2022-06-02 16:46:27 +08:00
parent 856f554a41
commit e6aa7de922
12 changed files with 31 additions and 11 deletions

2
public/css/app.css vendored

File diff suppressed because one or more lines are too long

2
public/js/app.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
54cbae2c450fdbef
70863ffd392b29a7

View File

@ -1,5 +1,5 @@
<template>
<div ref="aa" class="chat-input-box" :class="boxClass" v-clickoutside="hidePopover">
<div class="chat-input-box" :class="boxClass" v-clickoutside="hidePopover">
<div class="chat-input-wrapper" @click.stop="focus">
<!-- 输入框 -->
<div
@ -631,7 +631,10 @@ export default {
focus() {
this.$nextTick(() => {
this.quill && this.quill.focus()
if (this.quill) {
this.quill.setSelection(this.quill.getLength())
this.quill.focus()
}
})
},

View File

@ -204,6 +204,10 @@ export default {
type: Number,
default: 0
},
desktopAutoFocus: {
type: Boolean,
default: false
},
},
data() {
@ -370,6 +374,12 @@ export default {
cacheTimer && clearTimeout(cacheTimer);
setTimeout(this.onToBottom, Math.max(0, 100 - (new Date().getTime() - startTime)));
}).catch(_ => {});
//
if (this.$isDesktop && this.desktopAutoFocus) {
this.$nextTick(_ => {
this.$refs.input.focus()
})
}
}
},
immediate: true

View File

@ -140,7 +140,7 @@
<div class="msg-dialog-bg-icon"><Icon type="ios-chatbubbles" /></div>
<div class="msg-dialog-bg-text">{{$L('选择一个会话开始聊天')}}</div>
</div>
<DialogWrapper v-if="dialogId > 0" :dialogId="dialogId" @on-active="scrollIntoActive"/>
<DialogWrapper v-if="dialogId > 0" :dialogId="dialogId" @on-active="scrollIntoActive" desktop-auto-focus/>
</div>
</transition>

View File

@ -88,6 +88,13 @@
}
}
a {
&:before,
&:after {
display: none;
}
}
&.ql-blank {
&::before {
left: 7px;