1 |
- System.register(["./index-legacy-8b90e4bc.js"],(function(o,e){"use strict";var r,a,l,n,i,t,s,c,u,d,v,g,f,h,m,w,y,b,p,z,S;return{setters:[o=>{r=o.t,a=o.d,l=o.E,n=o.aw,i=o.c,t=o.v,s=o.ae,c=o.H,u=o.Y,d=o._,v=o.o,g=o.K,f=o.a,h=o.w,m=o.C,w=o.z,y=o.ar,b=o.bb,p=o.D,z=o.R,S=o.x}],execute:function(){const[e,x]=r("image"),L={src:String,alt:String,fit:String,position:String,round:Boolean,block:Boolean,width:h,height:h,radius:h,lazyLoad:Boolean,iconSize:h,showError:m,errorIcon:w("photo-fail"),iconPrefix:String,showLoading:m,loadingIcon:w("photo")};var E=a({name:e,props:L,emits:["load","error"],setup(o,{emit:e,slots:r}){const a=l(!1),h=l(!0),m=l(),{$Lazyload:w}=n().proxy,S=i((()=>{const e={width:t(o.width),height:t(o.height)};return s(o.radius)&&(e.overflow="hidden",e.borderRadius=t(o.radius)),e}));c((()=>o.src),(()=>{a.value=!1,h.value=!0}));const L=o=>{h.value&&(h.value=!1,e("load",o))},E=()=>{const o=new Event("load");Object.defineProperty(o,"target",{value:m.value,enumerable:!0}),L(o)},I=o=>{a.value=!0,h.value=!1,e("error",o)},P=(e,r,a)=>a?a():f(z,{name:e,size:o.iconSize,"class":r,classPrefix:o.iconPrefix},null),$=()=>{if(a.value||!o.src)return;const e={alt:o.alt,"class":x("img"),style:{objectFit:o.fit,objectPosition:o.position}};return o.lazyLoad?y(f("img",p({ref:m},e),null),[[b("lazy"),o.src]]):f("img",p({ref:m,src:o.src,onLoad:L,onError:I},e),null)},j=({el:o})=>{const e=()=>{o===m.value&&h.value&&E()};m.value?e():g(e)},k=({el:o})=>{o!==m.value||a.value||I()};return w&&u&&(w.$on("loaded",j),w.$on("error",k),d((()=>{w.$off("loaded",j),w.$off("error",k)}))),v((()=>{g((()=>{var e;(null==(e=m.value)?void 0:e.complete)&&!o.lazyLoad&&E()}))})),()=>{var e;return f("div",{"class":x({round:o.round,block:o.block}),style:S.value},[$(),h.value&&o.showLoading?f("div",{"class":x("loading")},[P(o.loadingIcon,x("loading-icon"),r.loading)]):a.value&&o.showError?f("div",{"class":x("error")},[P(o.errorIcon,x("error-icon"),r.error)]):void 0,null==(e=r["default"])?void 0:e.call(r)])}}});o("I",S(E))}}}));
|