code-origin/server/public/admin/assets/usePaging.160b82b8.js

2 lines
589 B
JavaScript
Raw Permalink Normal View History

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