import{m as a,aQ as e,aa as t,f as n,aK as u,M as l}from"./index-0ffeeea6.js";const i=10,o=1,v=10;function s(s,c=!0){const g=a(),r=a(o),f=a(i),m=a(v),d=a({});c&&(d.value=Object.assign({page:r.value,limit:f.value}));const p=a(!0);function h(){r.value>=100&&(p.value=!0),t.get(s,n(d)).then((a=>{var e;j(),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((()=>{j()}))}function j(){p.value=!1}function S(){h()}function b(){r.value=1}return e("paginate",{page:r,limit:f,total:m,changePage:function(a){r.value=a,d.value.page=a,S()},changeLimit:function(a){f.value=a,b(),d.value.page=1,d.value.limit=a,S()}}),{data:g,query:d,search:S,reset:function(){b(),d.value=Object.assign(c?{page:r.value,limit:f.value}:{}),h()},loading:p}}export{s as u};
