添加vue-virtual-scroller依赖并在消息视图中实现虚拟滚动功能,以优化对话列表的渲染性能。同时,为managerseller项目添加minimatch依赖项的解析版本以解决潜在的版本冲突。

This commit is contained in:
Ryan Ran
2025-07-15 16:16:42 +08:00
parent ef46380f9e
commit f1be18b7e3
5 changed files with 26 additions and 13 deletions

View File

@@ -24,6 +24,7 @@
"vue-cropper": "^0.5.5", "vue-cropper": "^0.5.5",
"vue-prism-editor": "^0.5.1", "vue-prism-editor": "^0.5.1",
"vue-router": "^3.4.9", "vue-router": "^3.4.9",
"vue-virtual-scroller": "^1.1.2",
"vuex": "^3.5.1" "vuex": "^3.5.1"
}, },
"devDependencies": { "devDependencies": {

View File

@@ -33,6 +33,11 @@ Object.keys(filters).forEach((key) => {
Vue.filter(key, filters[key]); Vue.filter(key, filters[key]);
}); });
import VueVirtualScroller from 'vue-virtual-scroller'
import 'vue-virtual-scroller/dist/vue-virtual-scroller.css'
Vue.component('RecycleScroller', VueVirtualScroller.RecycleScroller)
// 引入自定义全局css // 引入自定义全局css
import '@/assets/css/global.less' import '@/assets/css/global.less'

View File

@@ -65,9 +65,14 @@
> --> > -->
</p> </p>
<!-- 对话列表 --> <!-- 对话列表 -->
<template v-if="loadStatus === 1"> <RecycleScroller
<div v-for="(item, index) in userTalkItem" :key="item.id" class="talk-item pointer" :item-size="64"
:class="{ active: activeIndex == index }" @click="clickTab(item.userId, item, index)"> :items="userTalkItem"
:prerender="10"
v-slot="{ item, index }"
>
<div v-bind:key="item.id" class="talk-item pointer" :class="{ active: activeIndex == index }" @click="clickTab(item.userId, item, index)">
<div class="avatar-box"> <div class="avatar-box">
<face :text="item.face" v-if="item.face"></face> <face :text="item.face" v-if="item.face"></face>
<face-null :text="item.name" v-else></face-null> <face-null :text="item.name" v-else></face-null>
@@ -79,9 +84,7 @@
<div class="title"> <div class="title">
<div class="card-name"> <div class="card-name">
<p class="nickname"> <p class="nickname">
{{ {{ item.remark_name ? item.remark_name : item.name }}
item.remark_name ? item.remark_name : item.name
}}
</p> </p>
<div v-show="item.unread" class="larkc-tag"> <div v-show="item.unread" class="larkc-tag">
{{ item.unread }}条未读 {{ item.unread }}条未读
@@ -89,11 +92,9 @@
<div v-show="item.is_top" class="larkc-tag top"> <div v-show="item.is_top" class="larkc-tag top">
TOP TOP
</div> </div>
<div v-show="item.is_robot" class="larkc-tag top"> <div v-show="item.is_robot" class="larkc-tag top">
BOT BOT
</div> </div>
<div v-show="item.talk_type == 2" class="larkc-tag group"> <div v-show="item.talk_type == 2" class="larkc-tag group">
群组 群组
</div> </div>
@@ -111,9 +112,7 @@
<span v-if="item.lastMessageType === 'ORDER'">[订单链接]</span> <span v-if="item.lastMessageType === 'ORDER'">[订单链接]</span>
</div> </div>
<div class="content"> <div class="content">
<template v-if=" <template v-if="index_name != item.index_name && item.draft_text">
index_name != item.index_name && item.draft_text
">
<span class="draft-color">[草稿]</span> <span class="draft-color">[草稿]</span>
<span>{{ item.draft_text }}</span> <span>{{ item.draft_text }}</span>
</template> </template>
@@ -124,13 +123,12 @@
</span> </span>
<span v-else>[群消息]</span> <span v-else>[群消息]</span>
</template> </template>
<span>{{ item.msg_text }}</span> <span>{{ item.msg_text }}</span>
</template> </template>
</div> </div>
</div> </div>
</div> </div>
</template> </RecycleScroller>
</el-main> </el-main>
</el-scrollbar> </el-scrollbar>
</el-container> </el-container>
@@ -151,6 +149,8 @@
</div> </div>
</template> </template>
<script> <script>
import { RecycleScroller } from 'vue-virtual-scroller'
import 'vue-virtual-scroller/dist/vue-virtual-scroller.css'
import { mapGetters, mapState } from "vuex"; import { mapGetters, mapState } from "vuex";
import MainLayout from "@/views/layout/MainLayout"; import MainLayout from "@/views/layout/MainLayout";
import WelcomeModule from "@/components/layout/WelcomeModule"; import WelcomeModule from "@/components/layout/WelcomeModule";
@@ -179,6 +179,7 @@ export default {
UserSearch, UserSearch,
OtherLink, OtherLink,
WelcomeModule, WelcomeModule,
RecycleScroller
}, },
data () { data () {
return { return {

View File

@@ -48,5 +48,8 @@
"uglifyjs-webpack-plugin": "^2.2.0", "uglifyjs-webpack-plugin": "^2.2.0",
"vue-cli-plugin-style-resources-loader": "^0.1.4", "vue-cli-plugin-style-resources-loader": "^0.1.4",
"vue-template-compiler": "^2.6.10" "vue-template-compiler": "^2.6.10"
},
"resolutions": {
"minimatch": "^3.1.2"
} }
} }

View File

@@ -49,5 +49,8 @@
"view-design": "^4.6.1", "view-design": "^4.6.1",
"vue-cli-plugin-style-resources-loader": "^0.1.4", "vue-cli-plugin-style-resources-loader": "^0.1.4",
"vue-template-compiler": "^2.6.10" "vue-template-compiler": "^2.6.10"
},
"resolutions": {
"minimatch": "^3.1.2"
} }
} }