diff --git a/components/diy-components/diy-article.vue b/components/diy-components/diy-article.vue index 30aec58..2f8bee2 100644 --- a/components/diy-components/diy-article.vue +++ b/components/diy-components/diy-article.vue @@ -3,8 +3,14 @@ - + @@ -41,18 +47,18 @@ } }, data() { - return { - list: [], - loading: true, - skeletonConfig: { - gridRows: 1, - gridRowsGap: '40rpx', - headWidth: '160rpx', - headHeight: '160rpx', - textRows: 2 - } - }; - }, + return { + list: [], + loading: true, + skeletonConfig: { + gridRows: 1, + gridRowsGap: '40rpx', + headWidth: '160rpx', + headHeight: '160rpx', + textRows: 2 + } + }; + }, created() { this.getList(); }, @@ -63,6 +69,10 @@ } }, computed: { + // 获取swiper配置,默认空对象 + swiperConfig() { + return this.value?.swiperConfig || {}; + }, warpCss() { var obj = ''; obj += 'background-color:' + this.value.componentBgColor + ';'; @@ -74,6 +84,15 @@ } return obj; }, + // swiper容器样式 + swiperStyle() { + // 从swiperConfig获取高度,默认600rpx + const height = this.swiperConfig.swiperHeight || 600; + return { + height: height + 'rpx', + width: '100%' + }; + }, // 子项样式 itemCss() { var obj = ''; @@ -130,21 +149,29 @@