index-legacy-a4ac3c82.js 2.0 KB

1
  1. System.register(["./index-legacy-5dc194cf.js"],(function(o,e){"use strict";var r,a,l,n,i,t,s,c,u,d,v,g,f,h,y,m,p,w,b,S,x;return{setters:[o=>{r=o.w,a=o.d,l=o.S,n=o.aC,i=o.c,t=o.C,s=o.an,c=o.V,u=o.a7,d=o.a9,v=o.o,g=o.X,f=o.a,h=o.y,y=o.x,m=o.R,p=o.ax,w=o.b7,b=o.L,S=o.N,x=o.E}],execute:function(){const[e,z]=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:y,errorIcon:m("photo-fail"),iconPrefix:String,showLoading:y,loadingIcon:m("photo")};var E=a({name:e,props:L,emits:["load","error"],setup(o,{emit:e,slots:r}){const a=l(!1),h=l(!0),y=l(),{$Lazyload:m}=n().proxy,x=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:y.value,enumerable:!0}),L(o)},I=o=>{a.value=!0,h.value=!1,e("error",o)},P=(e,r,a)=>a?a():f(S,{name:e,size:o.iconSize,"class":r,classPrefix:o.iconPrefix},null),$=()=>{if(a.value||!o.src)return;const e={alt:o.alt,"class":z("img"),style:{objectFit:o.fit,objectPosition:o.position}};return o.lazyLoad?p(f("img",b({ref:y},e),null),[[w("lazy"),o.src]]):f("img",b({ref:y,src:o.src,onLoad:L,onError:I},e),null)},j=({el:o})=>{const e=()=>{o===y.value&&h.value&&E()};y.value?e():g(e)},k=({el:o})=>{o!==y.value||a.value||I()};return m&&u&&(m.$on("loaded",j),m.$on("error",k),d((()=>{m.$off("loaded",j),m.$off("error",k)}))),v((()=>{g((()=>{var e;(null==(e=y.value)?void 0:e.complete)&&!o.lazyLoad&&E()}))})),()=>{var e;return f("div",{"class":z({round:o.round,block:o.block}),style:x.value},[$(),h.value&&o.showLoading?f("div",{"class":z("loading")},[P(o.loadingIcon,z("loading-icon"),r.loading)]):a.value&&o.showError?f("div",{"class":z("error")},[P(o.errorIcon,z("error-icon"),r.error)]):void 0,null==(e=r["default"])?void 0:e.call(r)])}}});o("I",x(E))}}}));