Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Hooke
/
manulife-weapp
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Graphs
Network
Create a new issue
Commits
Issue Boards
Authored by
hookehuyr
2026-01-31 20:27:31 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
792914a52b1f4995cb4652c37abbfd3d32745d33
792914a5
1 parent
c3887658
fix(material-list): 修复切换标签时列表渲染异常问题
通过添加 v-if 和 key 强制重新渲染列表,避免切换标签时 Vue 复用组件导致的显示异常
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
2 deletions
src/pages/material-list/index.vue
src/pages/material-list/index.vue
View file @
792914a
...
...
@@ -38,7 +38,11 @@
</nut-tabs>
<!-- 列表容器(独立于 nut-tab-pane) -->
<view class="flex-1 min-h-0 overflow-y-auto px-[32rpx] pb-[calc(160rpx+env(safe-area-inset-bottom))] box-border">
<view
v-if="listVisible"
:key="listRenderKey"
class="flex-1 min-h-0 overflow-y-auto px-[32rpx] pb-[calc(160rpx+env(safe-area-inset-bottom))] box-border"
>
<view class="flex flex-col gap-[24rpx]">
<view v-for="(item, index) in currentList" :key="index"
class="material-item bg-white rounded-[24rpx] p-[24rpx] shadow-sm transition-all duration-200 border border-gray-50 flex flex-row"
...
...
@@ -95,7 +99,7 @@
</template>
<script setup>
import { ref, computed } from 'vue'
import { ref, computed
, nextTick
} from 'vue'
import { useLoad } from '@tarojs/taro'
import NavHeader from '@/components/NavHeader.vue'
import SearchBar from '@/components/SearchBar.vue'
...
...
@@ -106,6 +110,8 @@ import Taro from '@tarojs/taro'
const searchValue = ref('')
const activeTabId = ref('')
const listVisible = ref(true)
const listRenderKey = ref(0)
/**
* 页面标题
...
...
@@ -353,6 +359,11 @@ useLoad((options) => {
*/
const onTabClick = (id) => {
activeTabId.value = id
listVisible.value = false
nextTick(() => {
listRenderKey.value += 1
listVisible.value = true
})
// 可以在这里触发加载逻辑
// loadMaterialsByCategory(id)
}
...
...
Please
register
or
login
to post a comment