场景代码大概如下,删除了很多无关内容。import{reactive,ref,watch,inject,computed}from'vue'importSearchBarfrom'@/components/SearchBar.vue'constroute=useRoute()constpagination=reactive({page:1,pageSize:isPublic.value?10:9,total:0,})constkeyword=ref('')constfetchList=async()=>{loading.value=trueconstres=awaitconnect.get(`/api/${route.params.type}`,{params:{pageSize:pagination.pageSize,page:pagination.page,name:keyword.value,},})pagination.total=res.total
loading.value=false}watch(()=>route.params.type,async()=>{pagination.page=1fetchList()},{immediate:true})watch(()=>pagination.page,async()=>{fetchList()})watch(
...
继续阅读
(95)