对话框自动获取焦点

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> <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 class="chat-input-wrapper" @click.stop="focus">
<!-- 输入框 --> <!-- 输入框 -->
<div <div
@ -631,7 +631,10 @@ export default {
focus() { focus() {
this.$nextTick(() => { 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, type: Number,
default: 0 default: 0
}, },
desktopAutoFocus: {
type: Boolean,
default: false
},
}, },
data() { data() {
@ -370,6 +374,12 @@ export default {
cacheTimer && clearTimeout(cacheTimer); cacheTimer && clearTimeout(cacheTimer);
setTimeout(this.onToBottom, Math.max(0, 100 - (new Date().getTime() - startTime))); setTimeout(this.onToBottom, Math.max(0, 100 - (new Date().getTime() - startTime)));
}).catch(_ => {}); }).catch(_ => {});
//
if (this.$isDesktop && this.desktopAutoFocus) {
this.$nextTick(_ => {
this.$refs.input.focus()
})
}
} }
}, },
immediate: true immediate: true

View File

@ -140,7 +140,7 @@
<div class="msg-dialog-bg-icon"><Icon type="ios-chatbubbles" /></div> <div class="msg-dialog-bg-icon"><Icon type="ios-chatbubbles" /></div>
<div class="msg-dialog-bg-text">{{$L('选择一个会话开始聊天')}}</div> <div class="msg-dialog-bg-text">{{$L('选择一个会话开始聊天')}}</div>
</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> </div>
</transition> </transition>

View File

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