import{C as e,c as r,o as t,e as s,E as i,u as o,s as a,k as n,ac as d,l as u}from"./index-520dfaee.js";import{_ as l}from"./_plugin-vue_export-helper.1b428a4d.js";const p=l({__name:"su-image",props:{src:{type:String,default:""},errorSrc:{type:String,default:"/assets/addons/shopro/uniapp/empty_network.png"},mode:{type:String,default:"widthFix"},isPreview:{type:Boolean,default:!1},previewList:{type:Array,default:()=>[]},current:{type:Number,default:-1},height:{type:Number,default:0},width:{type:Number,default:0},radius:{type:Number,default:0}},emits:["load","error"],setup(l,{emit:p}){const c=l,g=e({isError:!1,imgHeight:600}),h=r((()=>({height:(c.height||g.imgHeight)+"rpx",width:c.width?c.width+"rpx":"100%",borderRadius:c.radius?c.radius+"rpx":""})));function m(e){0===c.height&&(g.imgHeight=e.detail.height/e.detail.width*750)}function f(e){g.isError=!0,p("error",e)}function y(){c.isPreview&&d({urls:c.previewList.length<1?[c.src]:c.previewList,current:c.current,longPressActions:{itemList:["发送给朋友","保存图片","收藏"],success:function(e){console.log("选中了第"+(e.tapIndex+1)+"个按钮,第"+(e.index+1)+"张图片")},fail:function(e){console.log(e.errMsg)}}})}return(e,r)=>{const d=u;return g.isError?n("",!0):(t(),s(d,{key:0,class:"su-img",style:i(o(h)),draggable:!1,mode:l.mode,src:o(a).$url.cdn(l.src),onClick:y,onLoad:m,onError:f},null,8,["style","mode","src"]))}}},[["__scopeId","data-v-77afe89d"]]);export{p as _};
