Coupon
Install
Usage
Basic Usage
API
CouponCell Props
| Attribute |
Description |
Type |
Default |
| title |
Cell title |
string |
Coupon |
| chosen-coupon |
Index of chosen coupon |
number | string |
-1 |
| coupons |
Coupon list |
Coupon[] |
[] |
| editable |
Cell editable |
boolean |
true |
| border |
Whether to show innner border |
boolean |
true |
| currency |
Currency symbol |
string |
¥ |
CouponList Props
| Attribute |
Description |
Type |
Default |
| v-model |
Current exchange code |
string |
- |
| chosen-coupon |
Index of chosen coupon |
number |
-1 |
| coupons |
Coupon list |
Coupon[] |
[] |
| disabled-coupons |
Disabled coupon list |
Coupon[] |
[] |
| enabled-title |
Title of coupon list |
string |
Available |
| disabled-title |
Title of disabled coupon list |
string |
Unavailable |
| exchange-button-text |
Exchange button text |
string |
Exchange |
| exchange-button-loading |
Whether to show loading in exchange button |
boolean |
false |
| exchange-button-disabled |
Whether to disable exchange button |
boolean |
false |
| exchange-min-length |
Min length to enable exchange button |
number |
1 |
| displayed-coupon-index |
Index of displayed coupon |
number |
- |
| close-button-text |
Close button text |
string |
Close |
| input-placeholder |
Input placeholder |
string |
Coupon code |
| currency |
Currency symbol |
string |
¥ |
| empty-image |
Placeholder image when list is empty |
string |
https://img.yzcdn.cn/vant/coupon-empty.png |
show-count v2.3.0 |
Whether to show coupon count in tab title |
boolean |
true |
CouponList Events
| Event |
Description |
Arguments |
| change |
Emitted when chosen coupon changed |
index: index of chosen coupon |
| exchange |
Emitted when exchanging coupon |
code: exchange code |
Data Structure of Coupon
| Key |
Description |
Type |
| id |
Id |
string |
| name |
Name |
string |
| condition |
Condition |
string |
| startAt |
Start time (Timestmap, unit second) |
number |
| endAt |
End time (Timestmap, unit second) |
number |
| description |
Description |
string |
| reason |
Unavailable reason |
string |
| value |
Value |
number |
| valueDesc |
Value Text |
string |
| unitDesc |
Unit Text |
string |
Less Variables
How to use: Custom Theme.
| Name |
Default Value |
Description |
| @coupon-margin |
0 @padding-sm @padding-sm |
- |
| @coupon-content-height |
84px |
- |
| @coupon-content-padding |
14px 0 |
- |
| @coupon-background-color |
@white |
- |
| @coupon-active-background-color |
@active-color |
- |
| @coupon-border-radius |
@border-radius-lg |
- |
| @coupon-box-shadow |
0 0 4px rgba(0, 0, 0, 0.1) |
- |
| @coupon-head-width |
96px |
- |
| @coupon-amount-color |
@red |
- |
| @coupon-amount-font-size |
30px |
- |
| @coupon-currency-font-size |
40% |
- |
| @coupon-name-font-size |
@font-size-md |
- |
| @coupon-disabled-text-color |
@gray-6 |
- |
| @coupon-description-padding |
@padding-xs @padding-md |
- |
| @coupon-description-border-color |
@border-color |
- |
| @coupon-list-background-color |
@background-color |
- |
| @coupon-list-field-padding |
5px 0 5px @padding-md |
- |
| @coupon-list-exchange-button-height |
32px |
- |
| @coupon-list-close-button-height |
40px |
- |
| @coupon-list-empty-image-size |
200px |
- |
| @coupon-list-empty-tip-color |
@gray-6 |
- |
| @coupon-list-empty-tip-font-size |
@font-size-md |
- |
| @coupon-list-empty-tip-line-height |
@line-height-md |
- |
| @coupon-cell-selected-text-color |
@text-color |
- |