【功能优化】装修页面优惠券,如果每行两个优惠券,则让优惠券居中,而不是分散在两边
parent
c8a95ef3ec
commit
ea8ea9e744
|
|
@ -1,7 +1,7 @@
|
||||||
<!-- 装修营销组件:优惠券 -->
|
<!-- 装修营销组件:优惠券 -->
|
||||||
<template>
|
<template>
|
||||||
<scroll-view class="scroll-box" scroll-x scroll-anchoring :style="[bgStyle, { marginLeft: `${data.space}px` }]">
|
<scroll-view class="scroll-box" scroll-x scroll-anchoring :style="[bgStyle, { marginLeft: `${data.space}px` }]">
|
||||||
<view class="coupon-box ss-flex">
|
<view class="coupon-box ss-flex" :style="columns === 2 ? couponBoxStyleTwo : couponBoxStyleNormal">
|
||||||
<view class="coupon-item" :style="[couponBg, { marginLeft: `${data.space}px` }]"
|
<view class="coupon-item" :style="[couponBg, { marginLeft: `${data.space}px` }]"
|
||||||
v-for="(item, index) in couponList" :key="index">
|
v-for="(item, index) in couponList" :key="index">
|
||||||
<su-coupon :size="SIZE_LIST[columns - 1]" :textColor="data.textColor" background="" :couponId="item.id"
|
<su-coupon :size="SIZE_LIST[columns - 1]" :textColor="data.textColor" background="" :couponId="item.id"
|
||||||
|
|
@ -63,6 +63,16 @@
|
||||||
background: button.bgColor,
|
background: button.bgColor,
|
||||||
color: button.color,
|
color: button.color,
|
||||||
};
|
};
|
||||||
|
// 两列优惠券时的排版方式
|
||||||
|
const couponBoxStyleNormal = {
|
||||||
|
'display': 'flex',
|
||||||
|
'justify-content': 'space-between'
|
||||||
|
};
|
||||||
|
// 非两列优惠券时的排版方式
|
||||||
|
const couponBoxStyleTwo = {
|
||||||
|
'display': 'flex',
|
||||||
|
'justify-content': 'space-around'
|
||||||
|
};
|
||||||
// 设置背景样式
|
// 设置背景样式
|
||||||
const bgStyle = computed(() => {
|
const bgStyle = computed(() => {
|
||||||
// 直接从 props.styles 解构
|
// 直接从 props.styles 解构
|
||||||
|
|
@ -138,11 +148,6 @@
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.scroll-box {
|
|
||||||
.coupon-box {
|
|
||||||
display: flex;
|
|
||||||
justify-content: space-between;
|
|
||||||
|
|
||||||
.card-btn {
|
.card-btn {
|
||||||
width: 140rpx;
|
width: 140rpx;
|
||||||
height: 50rpx;
|
height: 50rpx;
|
||||||
|
|
@ -168,6 +173,4 @@
|
||||||
margin-left: 0 !important;
|
margin-left: 0 !important;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
Loading…
Reference in New Issue