1 line
4.6 KiB
Plaintext
1 line
4.6 KiB
Plaintext
|
{"version":3,"file":"s-image-cube.js","sources":["../../../../../../src/sheep/components/s-image-cube/s-image-cube.vue","../../../../../../uniComponent:/RDovQXBwL1dvcmsvYWRkci9hY2RyLXVpL3NyYy9zaGVlcC9jb21wb25lbnRzL3MtaW1hZ2UtY3ViZS9zLWltYWdlLWN1YmUudnVl"],"sourcesContent":["<!-- 装修图文组件:广告魔方 -->\r\n<template>\r\n <view class=\"ss-cube-wrap\" :style=\"[parseAdWrap]\">\r\n <view v-for=\"(item, index) in data.list\" :key=\"index\">\r\n <view\r\n class=\"cube-img-wrap\"\r\n :style=\"[parseImgStyle(item), { margin: data.space + 'px' }]\"\r\n @tap=\"sheep.$router.go(item.url)\"\r\n >\r\n <image class=\"cube-img\" :src=\"sheep.$url.cdn(item.imgUrl)\" mode=\"aspectFill\"></image>\r\n </view>\r\n </view>\r\n </view>\r\n</template>\r\n<script setup>\r\n/**\r\n/**\r\n * 广告魔方\r\n *\r\n * @property {Array<Object>} list \t\t\t- 魔方列表\r\n * @property {Object} styles \t\t\t\t- 组件样式\r\n * @property {String} background \t\t\t- 组件背景色\r\n * @property {Number} topSpace \t\t\t\t- 组件顶部间距\r\n * @property {Number} bottomSpace \t\t\t- 组件底部间距\r\n * @property {Number} leftSpace \t\t\t- 容器左间距\r\n * @property {Number} rightSpace \t\t\t- 容器右间距\r\n * @property {Number} imgSpace \t\t\t\t- 图片间距\r\n * @property {Number} imgTopRadius \t\t\t- 图片上圆角\r\n * @property {Number} imgBottomRadius \t\t- 图片下圆角\r\n *\r\n */\r\n\r\nimport { computed, inject, unref } from 'vue'\r\nimport sheep from '@/sheep'\r\n\r\n// 参数\r\nconst props = defineProps({\r\n data: {\r\n type: Object,\r\n default() {},\r\n },\r\n styles: {\r\n type: Object,\r\n default() {},\r\n },\r\n})\r\n\r\n// 单元格大小\r\nconst windowWidth = sheep.$platform.device.windowWidth\r\nconst cell = computed(() => {\r\n return (\r\n (windowWidth -\r\n ((props.styles.marginLeft || 0) +\r\n (props.styles.marginRight || 0) +\r\n (props.styles.padding || 0) * 2)) /\r\n 4\r\n )\r\n})\r\n\r\n// 包裹容器高度\r\nconst parseAdWrap = computed(() => {\r\n const heightArr = props.data.list.reduce(\r\n (prev, cur) => (prev.includes(cur.height + cur.top) ? prev : [...prev, cur.height + cur.top]),\r\n [],\r\n )\r\n const heightMax = Math.max(...heightArr)\r\n return {\r\n height: heightMax * cell.value + 'px',\r\n width:\r\n windowWidth -\r\n (props.data?.style?.marginLeft + props.data?.style?.marginRight + props.styles.padding * 2) *\r\n 2 +\r\n 'px',\r\n }\r\n})\r\n\r\n// 解析图片大小位置\r\nconst parseImgStyle = (item) => {\r\n const obj = {\r\n width: item.width * cell.value - props.data.space + 'px',\r\n height: item.height * cell.value - props.data.space + 'px',\r\n left: item.left * cell.value + 'px',\r\n top: item.top * cell.value + 'px',\r\n 'border-top-left-radius': props.data.borderRadiusTop + 'px',\r\n 'border-top-right-radius': props.data.borderRadiusTop + 'px',\r\n 'border-bottom-left-radius': props.data.borderRadiusBottom + 'px',\r\n 'border-bottom-right-radius': props.data.borderRadiusBottom + 'px',\r\n }\r\n return obj\r\n}\r\n</script>\r\n\r\n<style lang=\"scss\" scoped>\r\n \r\n.ss-cube-wrap {\r\n position: relative;\r\n z-index: 2;\r\n width: 750rpx;\r\n}\r\n\r\n.cube-img-wrap {\r\n position: absolute;\r\n z-index: 3;\r\n overflow: hidden;\r\n}\r\n\r\n.cube-img {\r\n width: 100%;\r\n height: 100%;\r\n}\r\n</style>\r\n","import Component from 'D:/App/Work/addr/acdr-ui/src/sheep/components/s-image-cube/s-image-cube.vue'\nwx.createComponent(Component)"],"names":["sheep","computed"],"mappings":";;;;;;;;;;;;;;;;;;AAoCA,UAAM,QAAQ;AAYd,UAAM,cAAcA,YAAK,MAAC,UAAU,OAAO;AAC3C,UAAM,OAAOC,cAAQ,SAAC,MAAM;AAC1B,cACG,gBACG,MAAM,OAAO,cAAc,MAC1B,MAAM,OAAO,eAAe,MAC5B,MAAM,OAAO,WAAW,KAAK,MAClC;AAAA,IAEJ,CAAC;AAGD,UAAM,cAAcA,cAAQ,SAAC,MAAM;;AACjC,YAAM,YAAY,MAAM,KAAK,KAAK;AAAA,QAChC,CAAC,MAAM,QAAS,KAAK,SAAS,IAAI,SAAS,IAAI,GAAG,IAAI,OAAO,CAAC,GAAG,MAAM,IAAI,SAAS,IAAI,GAAG;AAAA,QAC3F,CAAE;AAAA,MACH;AACD,YAAM,YAAY,KA
|