diff --git a/components/diy/carousel.vue b/components/diy/carousel.vue index 972f2687..9977d8dd 100644 --- a/components/diy/carousel.vue +++ b/components/diy/carousel.vue @@ -128,11 +128,10 @@ const { common_style, actived_color } = new_style; // aspectFill 对应 cover aspectFit 对应 contain scaleToFill 对应 none - const { img_fit } = this.form; let fit = 'scaleToFill'; - if (img_fit == 'cover') { + if (new_form.img_fit == 'cover') { fit = 'aspectFill'; - } else if (img_fit == 'contain') { + } else if (new_form.img_fit == 'contain') { fit = 'aspectFit'; } this.$nextTick(() => { diff --git a/components/diy/img-magic.vue b/components/diy/img-magic.vue index 8ebad45c..b9a0841a 100644 --- a/components/diy/img-magic.vue +++ b/components/diy/img-magic.vue @@ -7,7 +7,7 @@ @@ -15,7 +15,7 @@ @@ -26,7 +26,7 @@ @@ -62,6 +62,7 @@ cube_cell: '', container_size: '', div_width: 0, + img_fit: '', }; }, watch: { @@ -90,6 +91,13 @@ const outer_sx = `-${new_style.image_spacing}rpx`; // 图片间距设置 const spacing = `${new_style.image_spacing}rpx`; + // aspectFill 对应 cover aspectFit 对应 contain scaleToFill 对应 none + let fit = 'scaleToFill'; + if (new_content.img_fit == 'cover') { + fit = 'aspectFill'; + } else if (new_content.img_fit == 'contain') { + fit = 'aspectFit'; + } const density = 4; this.setData({ form: this.propValue.content, @@ -99,6 +107,7 @@ content_img_radius: radius_computer(new_style), style_container: common_styles_computer(new_style.common_style) + 'box-sizing: border-box;', style_img_container: common_img_computer(new_style.common_style), + img_fit: fit, }); this.$nextTick(() => {