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