acdr-ui/dist/build/mp-weixin/modules/mall/sheep/components/s-image-cube/s-image-cube.js
2024-10-01 09:15:35 +08:00

2 lines
1.3 KiB
JavaScript

"use strict";const t=require("../../../../../common/vendor.js"),e=require("../../index.js"),a={__name:"s-image-cube",props:{data:{type:Object,default(){}},styles:{type:Object,default(){}}},setup(a){const d=a,r=e.sheep.$platform.device.windowWidth,o=t.computed((()=>(r-((d.styles.marginLeft||0)+(d.styles.marginRight||0)+2*(d.styles.padding||0)))/4)),s=t.computed((()=>{var t,e,a,s;const i=d.data.list.reduce(((t,e)=>t.includes(e.height+e.top)?t:[...t,e.height+e.top]),[]);return{height:Math.max(...i)*o.value+"px",width:r-2*((null==(e=null==(t=d.data)?void 0:t.style)?void 0:e.marginLeft)+(null==(s=null==(a=d.data)?void 0:a.style)?void 0:s.marginRight)+2*d.styles.padding)+"px"}})),i=t=>({width:t.width*o.value-d.data.space+"px",height:t.height*o.value-d.data.space+"px",left:t.left*o.value+"px",top:t.top*o.value+"px","border-top-left-radius":d.data.borderRadiusTop+"px","border-top-right-radius":d.data.borderRadiusTop+"px","border-bottom-left-radius":d.data.borderRadiusBottom+"px","border-bottom-right-radius":d.data.borderRadiusBottom+"px"});return(d,r)=>({a:t.f(a.data.list,((a,d,r)=>({a:t.unref(e.sheep).$url.cdn(a.imgUrl),b:t.s(i(a)),c:t.o((d=>t.unref(e.sheep).$router.go(a.url)),d),d:d}))),b:t.s({margin:a.data.space+"px"}),c:t.s(s.value)})}},d=t._export_sfc(a,[["__scopeId","data-v-d28debc2"]]);wx.createComponent(d);