su-image.53d60b59.js 1.4 KB

1
  1. import{v as e,c as r,e as t,f as i,y as s,u as o,s as a,g as n,ai as u,q as d}from"./index-9880b451.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:"/static/img/shop/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}),m=r((()=>({height:(c.height||g.imgHeight)+"rpx",width:c.width?c.width+"rpx":"100%",borderRadius:c.radius?c.radius+"rpx":""})));function h(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&&u({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 u=d;return g.isError?n("",!0):(t(),i(u,{key:0,class:"su-img",style:s(o(m)),draggable:!1,mode:l.mode,src:o(a).$url.cdn(l.src),onClick:y,onLoad:h,onError:f},null,8,["style","mode","src"]))}}},[["__scopeId","data-v-74e3b72e"]]);export{p as _};