message页面销毁时清除messageStore缓存

This commit is contained in:
bob
2024-09-24 16:14:00 +08:00
parent 1e41fc186b
commit 4dcf8dd89a
2 changed files with 13 additions and 2 deletions

View File

@@ -1,6 +1,6 @@
<!-- eslint-disable prettier/prettier -->
<script setup>
import { ref, onMounted, computed, watch, nextTick } from 'vue'
import { ref, onMounted, onUnmounted, computed, watch, nextTick } from 'vue'
import {
Phone,
VideoCamera,
@@ -80,6 +80,10 @@ onMounted(async () => {
if (userData.curSessionId) pullMsg() //页面加载进来,如果缓存了sessionId,则要加载对话
})
onUnmounted(() => {
messageData.clear()
})
const handleMsgListScroll = async () => {
if (msgListDiv.value.scrollTop === 0) {
const scrollHeight = msgListDiv.value.scrollHeight