"use strict";const a=require("./props.js"),t=require("../../libs/mixin/mpMixin.js"),h=require("../../libs/mixin/mixin.js"),n=require("../../libs/function/index.js"),r=require("../../../../common/vendor.js"),l={name:"u-image",mixins:[t.mpMixin,h.mixin,a.props],data(){return{isError:!1,loading:!0,opacity:1,durationTime:this.duration,backgroundStyle:{},show:!1}},watch:{src:{immediate:!0,handler(i){i?(this.isError=!1,this.loading=!0):this.isError=!0}}},computed:{wrapStyle(){let i={};return i.width=n.addUnit(this.width),i.height=n.addUnit(this.height),i.borderRadius=this.shape=="circle"?"10000px":n.addUnit(this.radius),i.overflow=this.radius>0?"hidden":"visible",n.deepMerge(i,n.addStyle(this.customStyle))}},mounted(){this.show=!0},emits:["click","error","load"],methods:{addUnit:n.addUnit,onClick(){this.$emit("click")},onErrorHandler(i){this.loading=!1,this.isError=!0,this.$emit("error",i)},onLoadHandler(i){this.loading=!1,this.isError=!1,this.$emit("load",i),this.removeBgColor()},removeBgColor(){this.backgroundStyle={backgroundColor:"transparent"}}}};if(!Array){const i=r.resolveComponent("u-icon"),d=r.resolveComponent("u-transition");(i+d)()}const u=()=>"../u-icon/u-icon.js",m=()=>"../u-transition/u-transition.js";Math||(u+m)();function c(i,d,w,f,o,e){return r.e({a:!o.isError},o.isError?{}:{b:i.src,c:i.mode,d:r.o((...s)=>e.onErrorHandler&&e.onErrorHandler(...s)),e:r.o((...s)=>e.onLoadHandler&&e.onLoadHandler(...s)),f:i.showMenuByLongpress,g:i.lazyLoad,h:i.shape=="circle"?"10000px":e.addUnit(i.radius),i:e.addUnit(i.width),j:e.addUnit(i.height)},{k:i.showLoading&&o.loading},i.showLoading&&o.loading?{l:r.p({name:i.loadingIcon,width:i.width,height:i.height}),m:i.shape=="circle"?"50%":e.addUnit(i.radius),n:this.bgColor,o:e.addUnit(i.width),p:e.addUnit(i.height)}:{},{q:i.showError&&o.isError&&!o.loading},i.showError&&o.isError&&!o.loading?{r:r.p({name:i.errorIcon,width:i.width,height:i.height}),s:i.shape=="circle"?"50%":e.addUnit(i.radius),t:e.addUnit(i.width),v:e.addUnit(i.height)}:{},{w:r.o((...s)=>e.onClick&&e.onClick(...s)),x:r.s(e.wrapStyle),y:r.s(o.backgroundStyle),z:r.p({mode:"fade",show:o.show,duration:i.fade?1e3:0})})}const g=r._export_sfc(l,[["render",c],["__scopeId","data-v-abebd402"]]);wx.createComponent(g);
