fix(CouponCell): incorrect value class

This commit is contained in:
chenjiahan 2020-08-17 22:38:18 +08:00
parent fc8009b6bf
commit 980f472259
4 changed files with 6 additions and 6 deletions

View File

@ -1,7 +1,7 @@
@import '../style/var'; @import '../style/var';
.van-coupon-cell { .van-coupon-cell {
&--selected { &__value--selected {
color: @coupon-cell-selected-text-color; color: @coupon-cell-selected-text-color;
} }
} }

View File

@ -39,7 +39,7 @@ function CouponCell(
slots: DefaultSlots, slots: DefaultSlots,
ctx: RenderContext<CouponCellProps> ctx: RenderContext<CouponCellProps>
) { ) {
const valueClass = props.coupons[+props.chosenCoupon] ? bem('selected') : ''; const selected = props.coupons[+props.chosenCoupon];
const value = formatValue(props); const value = formatValue(props);
return ( return (
@ -49,7 +49,7 @@ function CouponCell(
title={props.title || t('title')} title={props.title || t('title')}
border={props.border} border={props.border}
isLink={props.editable} isLink={props.editable}
valueClass={valueClass} valueClass={bem('value', { selected })}
{...inherit(ctx, true)} {...inherit(ctx, true)}
/> />
); );

View File

@ -5,7 +5,7 @@ exports[`renders demo correctly 1`] = `
<div> <div>
<div role="button" tabindex="0" class="van-cell van-cell--clickable van-coupon-cell"> <div role="button" tabindex="0" class="van-cell van-cell--clickable van-coupon-cell">
<div class="van-cell__title"><span>优惠券</span></div> <div class="van-cell__title"><span>优惠券</span></div>
<div class="van-cell__value"><span>2张可用</span></div><i class="van-icon van-icon-arrow van-cell__right-icon"> <div class="van-cell__value van-coupon-cell__value"><span>2张可用</span></div><i class="van-icon van-icon-arrow van-cell__right-icon">
<!----></i> <!----></i>
</div> </div>
<!----> <!---->

View File

@ -41,7 +41,7 @@ exports[`empty-image prop 1`] = `
exports[`render coupon cell 1`] = ` exports[`render coupon cell 1`] = `
<div role="button" tabindex="0" class="van-cell van-cell--clickable van-coupon-cell"> <div role="button" tabindex="0" class="van-cell van-cell--clickable van-coupon-cell">
<div class="van-cell__title"><span>优惠券</span></div> <div class="van-cell__title"><span>优惠券</span></div>
<div class="van-cell__value"><span>暂无可用</span></div><i class="van-icon van-icon-arrow van-cell__right-icon"> <div class="van-cell__value van-coupon-cell__value"><span>暂无可用</span></div><i class="van-icon van-icon-arrow van-cell__right-icon">
<!----></i> <!----></i>
</div> </div>
`; `;
@ -49,7 +49,7 @@ exports[`render coupon cell 1`] = `
exports[`render coupon cell with coupon 1`] = ` exports[`render coupon cell with coupon 1`] = `
<div role="button" tabindex="0" class="van-cell van-cell--clickable van-coupon-cell"> <div role="button" tabindex="0" class="van-cell van-cell--clickable van-coupon-cell">
<div class="van-cell__title"><span>优惠券</span></div> <div class="van-cell__title"><span>优惠券</span></div>
<div class="van-cell__value van-coupon-cell--selected"><span>-¥ 1.00</span></div><i class="van-icon van-icon-arrow van-cell__right-icon"> <div class="van-cell__value van-coupon-cell__value van-coupon-cell__value--selected"><span>-¥ 1.00</span></div><i class="van-icon van-icon-arrow van-cell__right-icon">
<!----></i> <!----></i>
</div> </div>
`; `;