【功能优化】装修页面优惠券,如果每行两个优惠券,则让优惠券居中,而不是分散在两边
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,36 +148,29 @@
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.scroll-box {
|
.card-btn {
|
||||||
.coupon-box {
|
width: 140rpx;
|
||||||
display: flex;
|
height: 50rpx;
|
||||||
justify-content: space-between;
|
border-radius: 25rpx;
|
||||||
|
font-size: 24rpx;
|
||||||
|
line-height: 50rpx;
|
||||||
|
|
||||||
.card-btn {
|
&.vertical {
|
||||||
width: 140rpx;
|
width: 50rpx;
|
||||||
height: 50rpx;
|
height: 140rpx;
|
||||||
border-radius: 25rpx;
|
margin: auto 20rpx auto 0;
|
||||||
|
|
||||||
|
.btn-text {
|
||||||
font-size: 24rpx;
|
font-size: 24rpx;
|
||||||
line-height: 50rpx;
|
text-align: center;
|
||||||
|
writing-mode: vertical-lr;
|
||||||
&.vertical {
|
|
||||||
width: 50rpx;
|
|
||||||
height: 140rpx;
|
|
||||||
margin: auto 20rpx auto 0;
|
|
||||||
|
|
||||||
.btn-text {
|
|
||||||
font-size: 24rpx;
|
|
||||||
text-align: center;
|
|
||||||
writing-mode: vertical-lr;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.coupon-item {
|
|
||||||
&:nth-of-type(1) {
|
|
||||||
margin-left: 0 !important;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.coupon-item {
|
||||||
|
&:nth-of-type(1) {
|
||||||
|
margin-left: 0 !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
</style>
|
</style>
|
Loading…
Reference in New Issue