perf: 优化消息性能

This commit is contained in:
kuaifan 2025-03-12 22:41:41 +08:00
parent 03f140fe3b
commit bc5343652b
3 changed files with 16 additions and 9 deletions

View File

@ -72,7 +72,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-15",
"vue-virtual-scroll-list-hi": "^2.3.5-16",
"vuedraggable": "^2.24.3",
"vuex": "^3.6.2"
},

View File

@ -1180,6 +1180,10 @@ export default {
}, 100)
},
getEditor() {
return this.fullInput ? this.fullQuill : this.quill
},
getText() {
if (this.quill) {
return `${this.quill.getText()}`.replace(/^\s+|\s+$/g, "")
@ -1230,16 +1234,17 @@ export default {
focus() {
this.$nextTick(() => {
if (this.quill) {
this.quill.setSelection(this.quill.getLength())
this.quill.focus()
const quill = this.getEditor();
if (quill) {
quill.setSelection(quill.getLength())
quill.focus()
}
})
},
blur() {
this.$nextTick(() => {
this.quill && this.quill.blur()
this.getEditor()?.blur()
})
},

View File

@ -206,7 +206,7 @@
@scroll="onScroll"
@totop="onPrevPage"
@range="onRange"
@active-range="onActiveRange"
@visible="onVisible"
@on-mention="onMention"
@on-longpress="onLongpress"
@ -1556,7 +1556,9 @@ export default {
setTimeout(_ => {
this.onSearchMsgId()
this.positionShow = this.readTimeout === null
this.startMsgId === 0 && (this.startMsgId = data.list[data.list.length - 1]?.id || 0)
if (this.startMsgId === 0 && data.list.length > 0) {
this.startMsgId = data.list[data.list.length - 1].id
}
}, 100)
}).catch(_ => {
this.errorId = dialog_id
@ -3052,8 +3054,8 @@ export default {
}
},
onActiveRange(array) {
this.startMsgId = $A.runNum(array.length > 0 ? array[0] : 0)
onVisible(v) {
this.startMsgId = $A.runNum(v.length > 0 ? v[0] : 0)
},
onBack() {