From 980f472259631d1167115b185f6e065e5ade905c Mon Sep 17 00:00:00 2001 From: chenjiahan Date: Mon, 17 Aug 2020 22:38:18 +0800 Subject: [PATCH] fix(CouponCell): incorrect value class --- src/coupon-cell/index.less | 2 +- src/coupon-cell/index.tsx | 4 ++-- src/coupon-list/test/__snapshots__/demo.spec.js.snap | 2 +- src/coupon-list/test/__snapshots__/index.spec.js.snap | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/coupon-cell/index.less b/src/coupon-cell/index.less index c7e50c86d..1a2da079e 100644 --- a/src/coupon-cell/index.less +++ b/src/coupon-cell/index.less @@ -1,7 +1,7 @@ @import '../style/var'; .van-coupon-cell { - &--selected { + &__value--selected { color: @coupon-cell-selected-text-color; } } diff --git a/src/coupon-cell/index.tsx b/src/coupon-cell/index.tsx index a8d2bafcd..46259f10f 100644 --- a/src/coupon-cell/index.tsx +++ b/src/coupon-cell/index.tsx @@ -39,7 +39,7 @@ function CouponCell( slots: DefaultSlots, ctx: RenderContext ) { - const valueClass = props.coupons[+props.chosenCoupon] ? bem('selected') : ''; + const selected = props.coupons[+props.chosenCoupon]; const value = formatValue(props); return ( @@ -49,7 +49,7 @@ function CouponCell( title={props.title || t('title')} border={props.border} isLink={props.editable} - valueClass={valueClass} + valueClass={bem('value', { selected })} {...inherit(ctx, true)} /> ); diff --git a/src/coupon-list/test/__snapshots__/demo.spec.js.snap b/src/coupon-list/test/__snapshots__/demo.spec.js.snap index 73c038f70..8c2fdd67d 100644 --- a/src/coupon-list/test/__snapshots__/demo.spec.js.snap +++ b/src/coupon-list/test/__snapshots__/demo.spec.js.snap @@ -5,7 +5,7 @@ exports[`renders demo correctly 1`] = `
优惠券
-
2张可用
+
2张可用
diff --git a/src/coupon-list/test/__snapshots__/index.spec.js.snap b/src/coupon-list/test/__snapshots__/index.spec.js.snap index b6db0680b..1c6330ea1 100644 --- a/src/coupon-list/test/__snapshots__/index.spec.js.snap +++ b/src/coupon-list/test/__snapshots__/index.spec.js.snap @@ -41,7 +41,7 @@ exports[`empty-image prop 1`] = ` exports[`render coupon cell 1`] = `
优惠券
-
暂无可用
+
暂无可用
`; @@ -49,7 +49,7 @@ exports[`render coupon cell 1`] = ` exports[`render coupon cell with coupon 1`] = `
优惠券
-
-¥ 1.00
+
-¥ 1.00
`;