Răsfoiți Sursa

只看我的功能

cxmo 2 ani în urmă
părinte
comite
845584af90
1 a modificat fișierele cu 13 adăugiri și 3 ștergeri
  1. 13 3
      src/views/chartETA/List.vue

+ 13 - 3
src/views/chartETA/List.vue

@@ -1,6 +1,6 @@
 <script setup>
 //ETA图库页面
-import {ref,reactive} from 'vue'
+import {ref,reactive,watch, nextTick} from 'vue'
 import { showToast,showDialog} from "vant";
 import { useWindowSize } from '@vueuse/core'
 import CatalogTree from './components/CatalogTree.vue';
@@ -252,12 +252,12 @@ const listState = reactive({
 })
 //获取图表列表
 async function getChartList(){
-    const {pageSize,cid,page} = listState
+    const {pageSize,cid,page,IsShowMe} = listState
     const res = await apiChart.pubChartList({
         PageSize: pageSize,
         CurrentIndex: page,
         ChartClassifyId: cid,
-        IsShowMe: false
+        IsShowMe,
     })
     if(res.Ret!==200) return 
     const arr = res.Data?res.Data.List:[]
@@ -267,6 +267,16 @@ async function getChartList(){
     listState.loading=false
 }
 
+watch(()=>listState.IsShowMe,()=>{
+    window.scrollTo({top:0})
+    listState.list=[]
+    listState.page=1
+    //设置数据已加载完毕,因为当滚动条不在顶部时,清空列表内容会触发onLoad
+    listState.finished = true 
+    //这个函数调用完成后,会把finished重置成正确的值
+    getChartList()
+})
+
 //下拉加载
 function onLoad(){
     if(IsShowCatalog.value) return