perf: 优化发消息时有时候出现空白需要滚动才出现内容的情况

This commit is contained in:
kuaifan 2022-07-14 12:58:14 +08:00
parent 26d0d07850
commit 0835e5b069
3 changed files with 34 additions and 22 deletions

View File

@ -62,8 +62,8 @@
</ul>
</div>
<!--等待-->
<div v-else-if="msgData.type === 'loading'" class="content-text no-dark-content">
......
<div v-else-if="msgData.type === 'loading'" class="content-loading">
<Loading/>
</div>
<!--未知-->
<div v-else class="content-unknown">{{$L("未知的消息类型")}}</div>

View File

@ -934,26 +934,28 @@ export default {
text: typeLoad ? '' : msgText,
},
}
this.tempMsgs.push(tempMsg)
this.msgType = ''
this.replyActiveId = 0;
this.onActive();
this.$nextTick(this.onToBottom)
//
this.$store.dispatch("call", {
url: 'dialog/msg/sendtext',
data: {
dialog_id: tempMsg.dialog_id,
reply_id: tempMsg.reply_id,
text: msgText,
},
method: 'post',
complete: _ => this.tempMsgs = this.tempMsgs.filter(({id}) => id != tempId)
}).then(({data}) => {
this.sendSuccess(data)
}).catch(({msg}) => {
$A.modalError(msg)
});
setTimeout(_ => {
this.tempMsgs.push(tempMsg)
this.msgType = ''
this.replyActiveId = 0;
this.onActive();
this.$nextTick(this.onToBottom)
//
this.$store.dispatch("call", {
url: 'dialog/msg/sendtext',
data: {
dialog_id: tempMsg.dialog_id,
reply_id: tempMsg.reply_id,
text: msgText,
},
method: 'post',
complete: _ => this.tempMsgs = this.tempMsgs.filter(({id}) => id != tempId)
}).then(({data}) => {
this.sendSuccess(data)
}).catch(({msg}) => {
$A.modalError(msg)
});
}, 10)
}
},

View File

@ -740,6 +740,16 @@
}
}
.content-loading {
display: flex;
.common-loading {
width: 20px;
height: 20px;
margin: 4px;
}
}
.content-unknown {
text-decoration: underline;
}