no message

This commit is contained in:
kuaifan 2022-06-07 14:08:53 +08:00
parent a32faf1a99
commit 6875b1b8af
2 changed files with 20 additions and 6 deletions

View File

@ -54,7 +54,7 @@
"vue-resize-observer": "^2.0.16", "vue-resize-observer": "^2.0.16",
"vue-router": "^3.5.3", "vue-router": "^3.5.3",
"vue-template-compiler": "^2.6.14", "vue-template-compiler": "^2.6.14",
"vue-virtual-scroller-hi": "^1.0.10-2", "vue-virtual-scroller-hi": "^1.0.10-3",
"vuedraggable": "^2.24.3", "vuedraggable": "^2.24.3",
"vuex": "^3.6.2", "vuex": "^3.6.2",
"webpack": "^5.69.1", "webpack": "^5.69.1",

View File

@ -73,6 +73,7 @@
<DynamicScroller <DynamicScroller
ref="scroller" ref="scroller"
class="dialog-scroller scrollbar-overlay" class="dialog-scroller scrollbar-overlay"
:style="{visibility: scrollerShow ? 'visible' : 'hidden'}"
:disabled="touchBackInProgress" :disabled="touchBackInProgress"
:items="allMsgs" :items="allMsgs"
:min-item-size="58" :min-item-size="58"
@ -328,6 +329,7 @@ export default {
dialogDrag: false, dialogDrag: false,
groupInfoShow: false, groupInfoShow: false,
scrollerShow: false,
navStyle: {}, navStyle: {},
@ -449,6 +451,7 @@ export default {
dialogId: { dialogId: {
handler(id) { handler(id) {
if (id) { if (id) {
this.scrollerShow = false;
this.msgNew = 0; this.msgNew = 0;
this.topId = -1; this.topId = -1;
// //
@ -456,13 +459,19 @@ export default {
if (this.allMsgList.length > 0) { if (this.allMsgList.length > 0) {
cacheTimer = setTimeout(_ => { cacheTimer = setTimeout(_ => {
this.allMsgs = this.allMsgList; this.allMsgs = this.allMsgList;
this.onToBottom(); this.onToBottom().then(_ => {
this.scrollerShow = true
});
}, 1); }, 1);
} }
const startTime = new Date().getTime(); const startTime = new Date().getTime();
this.$store.dispatch("getDialogMsgs", id).then(_ => { this.$store.dispatch("getDialogMsgs", id).then(_ => {
cacheTimer && clearTimeout(cacheTimer); cacheTimer && clearTimeout(cacheTimer);
setTimeout(this.onToBottom, Math.max(0, 100 - (new Date().getTime() - startTime))); setTimeout(_ => {
this.onToBottom().then(_ => {
this.scrollerShow = true
});
}, Math.max(0, 100 - (new Date().getTime() - startTime)));
}).catch(_ => {}); }).catch(_ => {});
// //
this.$store.dispatch('saveInDialog', { this.$store.dispatch('saveInDialog', {
@ -773,9 +782,14 @@ export default {
onToBottom() { onToBottom() {
this.msgNew = 0; this.msgNew = 0;
return new Promise(resolve => {
if (this.isReady) { if (this.isReady) {
this.$refs.scroller?.scrollToBottom(); this.$refs.scroller?.scrollToBottom();
requestAnimationFrame(resolve)
} else {
resolve();
} }
})
}, },
openProject() { openProject() {