2 lines
1.2 KiB
JavaScript
2 lines
1.2 KiB
JavaScript
"use strict";const e=require("../../../common/vendor.js"),r=require("../../index.js"),t={__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(t,{emit:i}){const s=e.reactive({isError:!1,imgHeight:600}),u=t,o=i,n=e.computed((()=>({height:(u.height||s.imgHeight)+"rpx",width:u.width?u.width+"rpx":"100%",borderRadius:u.radius?u.radius+"rpx":""})));function d(e){0===u.height&&(s.imgHeight=e.detail.height/e.detail.width*750)}function a(e){s.isError=!0,o("error",e)}function c(){u.isPreview&&e.index.previewImage({urls:u.previewList.length<1?[u.src]:u.previewList,current:u.current,longPressActions:{itemList:["发送给朋友","保存图片","收藏"],success:function(e){},fail:function(e){}}})}return(i,u)=>e.e({a:!s.isError},s.isError?{}:{b:e.s(n.value),c:t.mode,d:e.unref(r.sheep).$url.cdn(t.src),e:e.o(c),f:e.o(d),g:e.o(a)})}},i=e._export_sfc(t,[["__scopeId","data-v-8f614499"]]);wx.createComponent(i);
|