WokerTask/public/admin/assets/usePaging.2ad8e1e6.js

2 lines
667 B
JavaScript
Raw Normal View History

2023-12-27 14:06:33 +08:00
import{t as u,$ as r}from"./@vue.51d7f2d8.js";function m(i){const{page:o=1,size:l=15,fetchFun:c,params:a={},firstLoading:g=!1}=i,n=Object.assign({},u(a)),s=r({page:o,size:l,loading:g,count:0,lists:[],extend:{}}),e=()=>(s.loading=!0,c({page_no:s.page,page_size:s.size,...a}).then(t=>(s.count=t==null?void 0:t.count,t.lists?s.lists=t.lists:s.lists=t.data,(s.lists==[]||s.lists==null||s.lists==null)&&t.list&&(s.lists=t.list),s.extend=t==null?void 0:t.extend,Promise.resolve(t))).catch(t=>Promise.reject(t)).finally(()=>{s.loading=!1}));return{pager:s,getLists:e,resetParams:()=>{Object.keys(n).forEach(t=>{a[t]=n[t]}),e()},resetPage:()=>{s.page=1,e()}}}export{m as u};