perf: 优化阅读消息列表机制

This commit is contained in:
Pang 2023-12-16 01:22:15 +08:00
parent 9f186f1e9c
commit 2bebad1112
4 changed files with 11 additions and 12 deletions

View File

@ -68,7 +68,7 @@
"vue-resize-observer": "^2.0.16",
"vue-router": "^3.6.5",
"vue-template-compiler": "~2.6.14",
"vue-virtual-scroll-list-hi": "^2.3.5-5",
"vue-virtual-scroll-list-hi": "^2.3.5-7",
"vuedraggable": "^2.24.3",
"vuex": "^3.6.2"
},

View File

@ -170,10 +170,7 @@ export default {
if (!this.windowActive) {
return;
}
if (!this.$el) {
return;
}
if (this.$el.parentNode.classList.contains('inactive')) {
if (!this.$el?.parentNode.classList.contains('item-enter')) {
return;
}
//

View File

@ -148,7 +148,7 @@
<VirtualList
ref="scroller"
class="dialog-scroller scrollbar-virtual"
item-inactive-class="inactive"
active-prefix="item"
:class="scrollerClass"
:data-key="'id'"
:data-sources="allMsgs"
@ -974,9 +974,6 @@ export default {
}))
if (item.label === '{UNREAD}') {
item.label = this.$L(`未读消息${unread}`)
item.is_unread = unread > 1
} else {
item.is_unread = false
}
return item
},
@ -1217,8 +1214,13 @@ export default {
}
},
positionMsg(msg) {
if (msg && msg.is_unread === true) {
positionMsg() {
const {unread, position_msgs} = this.dialogData
if (!$A.isArray(position_msgs) || unread < 2) {
return
}
const msg = position_msgs.find(item => item.label === '{UNREAD}')
if (msg) {
this.unreadMsgId = msg.msg_id
}
}

View File

@ -432,7 +432,7 @@
-webkit-overflow-scrolling: touch;
}
.inactive {
.item-leave {
pre, code {
visibility: hidden;
}