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