|
@@ -124,7 +124,7 @@
|
|
|
|
|
|
<!-- 根据当前标签显示不同样式的列表 -->
|
|
|
<!-- 关注列表 - 类似my.vue -->
|
|
|
- <view v-if="currentTab === 0" class="follow-list">
|
|
|
+ <view v-show="currentTab === 0" class="follow-list">
|
|
|
<block v-if="followList.length > 0">
|
|
|
<view class="works-list">
|
|
|
<view class="work-item" v-for="(item, index) in followList" :key="index"
|
|
@@ -140,7 +140,7 @@
|
|
|
</view>
|
|
|
|
|
|
<!-- 推荐列表 - 瀑布流样式 -->
|
|
|
- <w-waterfall v-if="currentTab === 1 && recommendList.length > 0" :data="recommendList">
|
|
|
+ <w-waterfall v-show="currentTab === 1 && recommendList.length > 0" :data="recommendList">
|
|
|
<template v-slot:content="{item,width}">
|
|
|
<card :item="formatItem(item)" :width="width" :custom-style="{background:'#fff'}"
|
|
|
textColor="#000"></card>
|
|
@@ -148,7 +148,7 @@
|
|
|
</w-waterfall>
|
|
|
|
|
|
<!-- 探索列表 - 热点新闻已经有现成的热搜资讯组件,只需添加新闻列表 -->
|
|
|
- <view v-if="currentTab === 2 && newsList.length > 0" class="news-list">
|
|
|
+ <view v-show="currentTab === 2 && newsList.length > 0" class="news-list">
|
|
|
<view class="news-grid">
|
|
|
<view class="news-item" v-for="(item, index) in newsList" :key="index"
|
|
|
@click="goToArticleDetail(item.id)">
|
|
@@ -413,11 +413,17 @@
|
|
|
},
|
|
|
switchTab(index) {
|
|
|
this.currentTab = index;
|
|
|
- // 根据需要加载对应标签的数据
|
|
|
+
|
|
|
+ // Check if the target tab's list is already populated
|
|
|
+ if (this.currentList.length > 0) {
|
|
|
+ // If the list is already populated, do not fetch data again
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ // If the list is not populated, load the corresponding data
|
|
|
this.loadTabData(index);
|
|
|
},
|
|
|
loadTabData(index) {
|
|
|
- // 这里添加加载不同标签数据的逻辑
|
|
|
switch (index) {
|
|
|
case 0:
|
|
|
if (!this.followList.length) {
|
|
@@ -430,7 +436,6 @@
|
|
|
}
|
|
|
break;
|
|
|
case 2:
|
|
|
- // 加载热点新闻和新闻列表
|
|
|
if (!this.hotNewsList.length) {
|
|
|
this.loadHotNews();
|
|
|
}
|