import{aq as e,b as s,f as t,h as n,i as a,w as o,z as r,E as c,o as i,A as l}from"./index-230eb087.js";const u={lock:!0,text:"加载中..."},d=(s,t={})=>{let n;const a=()=>{n&&n.close()},o={...u,...t};return(...t)=>{try{r=o,n=e.service(r);const c=s(...t);return c instanceof Promise?c.then((e=>e)).catch((e=>{throw e})).finally((()=>{a()})):(a(),Promise.resolve(c))}catch(c){throw a(),c}var r}},h={code:0,data:{},message:"获取成功"};function m(){return new Promise((e=>{setTimeout((()=>{e(h)}),1e3)}))}function f(){return new Promise(((e,s)=>{setTimeout((()=>{s(new Error("发生错误"))}),1e3)}))}const g={class:"app-container"},w=r("h4",null,"该示例是演示:通过将要执行的函数传递给 hook,让 hook 自动开启全屏 loading,函数执行结束后自动关闭 loading",-1),p=s({__name:"use-fullscreen-loading",setup(e){const s={text:"即将发生错误...",background:"#F56C6C20",svg:'\n \n',svgViewBox:"-10, -10, 50, 50"},r=async()=>{const e=await d(m)();c.success(e.message)},u=async()=>{try{await d(f,s)()}catch(e){c.error(e.message)}};return(e,s)=>{const c=t("el-button");return i(),n("div",g,[w,a(c,{onClick:r},{default:o((()=>[l("查询成功")])),_:1}),a(c,{onClick:u},{default:o((()=>[l("查询失败")])),_:1})])}}});export{p as default};