import{m as a,bF as e,ac as t,f as n,cq as u,M as l}from"./index-41bf27b7.js";const i=10,o=1,v=10;function c(c,s=!0){const g=a(),r=a(o),f=a(i),m=a(v),d=a({});s&&(d.value=Object.assign({page:r.value,limit:f.value}));const p=a(!0);function h(){r.value>=100&&(p.value=!0),t.get(c,n(d)).then((a=>{var e;b(),a.data.code===u.SUCCESS?(g.value=a.data,m.value=null==(e=g.value)?void 0:e.total):l.error(a.data.message)})).finally((()=>{b()}))}function b(){p.value=!1}function j(){h()}function S(){r.value=1}return e("paginate",{page:r,limit:f,total:m,changePage:function(a){r.value=a,d.value.page=a,j()},changeLimit:function(a){f.value=a,S(),d.value.page=1,d.value.limit=a,j()}}),{data:g,query:d,search:j,reset:function(){S(),s&&(d.value=Object.assign({page:r.value,limit:f.value})),h()},loading:p}}export{c as u};
