no message

This commit is contained in:
kuaifan 2021-06-14 17:52:17 +08:00
parent e7874661f3
commit 438f74fac9
2 changed files with 14 additions and 7 deletions

View File

@ -124,7 +124,14 @@ export default {
autoToBottom() { autoToBottom() {
if (this.autoBottom && this.$refs.bottom) { if (this.autoBottom && this.$refs.bottom) {
try {
this.$refs.bottom.scrollIntoView(false); this.$refs.bottom.scrollIntoView(false);
} catch (e) {
scrollIntoView(this.$refs.bottom, {
behavior: 'instant',
inline: 'end',
})
}
} }
}, },

View File

@ -14,7 +14,7 @@
v-for="(dialog, key) in dialogLists" v-for="(dialog, key) in dialogLists"
:key="key" :key="key"
:class="{active: dialog.id == dialogId}" :class="{active: dialog.id == dialogId}"
@click="openDialog(dialog)"> @click="openDialog(dialog, true)">
<Icon v-if="dialog.type=='group'" class="icon-avatar" type="ios-people" /> <Icon v-if="dialog.type=='group'" class="icon-avatar" type="ios-people" />
<div v-else-if="dialog.dialog_user" class="user-avatar"><UserAvatar :userid="dialog.dialog_user.userid" :size="46" hide-icon-menu/></div> <div v-else-if="dialog.dialog_user" class="user-avatar"><UserAvatar :userid="dialog.dialog_user.userid" :size="46" hide-icon-menu/></div>
<Icon v-else class="icon-avatar" type="md-person" /> <Icon v-else class="icon-avatar" type="md-person" />
@ -122,17 +122,17 @@ export default {
}, },
methods: { methods: {
openDialog(dialog) { openDialog(dialog, smooth) {
this.$store.state.method.setStorage("messengerDialogId", dialog.id) this.$store.state.method.setStorage("messengerDialogId", dialog.id)
this.$store.dispatch("getDialogMsgList", dialog.id); this.$store.dispatch("getDialogMsgList", dialog.id);
this.scrollIntoActive(); this.scrollIntoActive(smooth);
}, },
openDialogStorage() { openDialogStorage() {
let tmpId = this.$store.state.method.getStorageInt("messengerDialogId") let tmpId = this.$store.state.method.getStorageInt("messengerDialogId")
if (tmpId > 0) { if (tmpId > 0) {
const dialog = this.dialogList.find(({id}) => id === tmpId); const dialog = this.dialogList.find(({id}) => id === tmpId);
dialog && this.openDialog(dialog); dialog && this.openDialog(dialog, false);
} }
}, },
@ -214,13 +214,13 @@ export default {
return null; return null;
}, },
scrollIntoActive() { scrollIntoActive(smooth) {
this.$nextTick(() => { this.$nextTick(() => {
if (this.$refs.list) { if (this.$refs.list) {
let active = this.$refs.list.querySelector(".active") let active = this.$refs.list.querySelector(".active")
if (active) { if (active) {
scrollIntoView(active, { scrollIntoView(active, {
behavior: 'instant', behavior: smooth === true ? 'smooth' : 'instant',
scrollMode: 'if-needed', scrollMode: 'if-needed',
}); });
} }