2 lines
746 B
JavaScript
2 lines
746 B
JavaScript
|
import{t as f,$ as p}from"./@vue.51d7f2d8.js";function m(l){const{page:c=1,size:g=15,fetchFun:r,params:n={},firstLoading:u=!1,json:a}=l,o=Object.assign({},f(n)),s=p({page:c,size:g,loading:u,count:0,lists:[],extend:{}}),e=()=>(s.loading=!0,r({page_no:s.page,page_size:s.size,...n}).then(t=>(s.count=t==null?void 0:t.count,t.lists?s.lists=t.lists:s.lists=t.data,(s.lists==[]||s.lists==null||s.lists==null)&&t.list&&(s.lists=t.list),s.extend=t==null?void 0:t.extend,a&&t.lists.forEach(i=>{typeof i[a]=="string"&&(i[a]=JSON.parse(i[a]))}),Promise.resolve(t))).catch(t=>Promise.reject(t)).finally(()=>{s.loading=!1}));return{pager:s,getLists:e,resetParams:()=>{Object.keys(o).forEach(t=>{n[t]=o[t]}),e()},resetPage:()=>{s.page=1,e()}}}export{m as u};
|