Coupon 优惠券
补充优惠券卡片与底部选择面板两种业务场景,支持领取、筛选和关闭不使用优惠券
演示
9:41
代码示例
引入
推荐使用 easycom 模式,配置后无需手动 import 即可直接使用 <re-coupon />。
API
Coupon Props
| 名称 | 类型 | 默认值 | 描述 | 必传 |
|---|---|---|---|---|
| mode | string | 'selector' | - | N |
| type | string | 'large' | - | N |
| pricePosition | string | 'back' | - | N |
| couponData | CouponCardData | { | - | N |
| btnText | string | translate('coupon', 'receiveNow', '立即领取') | - | N |
| isReceived | boolean | false | - | N |
| usedText | string | translate('coupon', 'received', '已领取') | - | N |
| buttonDisabled | boolean | false | - | N |
| visible | boolean | false | - | N |
| coupons | Array<CouponItem> | as Array<CouponItem> | - | N |
| chosenCoupon | number | -1 | - | N |
| showExchangeBar | boolean | true | - | N |
| exchangeCode | string | '' | - | N |
| enabledTitle | string | translate('coupon', 'enabledTitle', '可用优惠券') | - | N |
| disabledTitle | string | translate('coupon', 'disabledTitle', '不可用优惠券') | - | N |
| showCloseButton | boolean | true | - | N |
| closeButtonText | string | translate('coupon', 'noCoupon', '不使用优惠券') | - | N |
| inputPlaceholder | string | translate('coupon', 'exchangePlaceholder', '请输入兑换码') | - | N |
| exchangeButtonText | string | translate('coupon', 'exchangeButtonText', '兑换') | - | N |
| exchangeButtonDisabled | boolean | false | - | N |
| displayedCouponIndex | number | -1 | - | N |
| customStyle | string | '' | 自定义样式 | N |
Coupon Events
| 名称 | 参数 | 描述 |
|---|---|---|
| click | data: CouponCardData | 点击时触发 |
| button-click | data: CouponCardData | - |
| exchange | code: string | - |
| change | couponId: number | 值变化时触发 |
| list | - | - |
| close | - | 关闭时触发 |
| update:visible | value: boolean | 显隐变化时触发 |
| update:chosenCoupon | value: number | - |
Coupon Slots
| 名称 | 描述 |
|---|---|
| - | - |
