moreShopAdmin/dist/assets/usePaging.6a6670f9.js

2 lines
546 B
JavaScript

import{t as u,Z as l}from"./@vue.18505fe0.js";function P(o){const{page:i=1,size:c=15,fetchFun:r,params:e={},firstLoading:g=!1}=o,n=Object.assign({},u(e)),a=l({page:i,size:c,loading:g,count:0,lists:[]}),s=()=>(a.loading=!0,r({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,Promise.resolve(t))).catch(t=>Promise.reject(t)).finally(()=>{a.loading=!1}));return{pager:a,getLists:s,resetParams:()=>{Object.keys(n).forEach(t=>{e[t]=n[t]}),s()},resetPage:()=>{a.page=1,s()}}}export{P as u};