mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-25 19:06:36 +08:00
[Improvement] CouponList: add exchangeMinLength prop (#556)
This commit is contained in:
parent
c8875f60cc
commit
91872a3101
@ -84,6 +84,7 @@ export default {
|
|||||||
| disabled-coupons | Disabled voupon list | `Array` | `[]` | - |
|
| disabled-coupons | Disabled voupon list | `Array` | `[]` | - |
|
||||||
| exchange-button-text | Exchange button text | `String` | `Exchange` | - |
|
| exchange-button-text | Exchange button text | `String` | `Exchange` | - |
|
||||||
| exchange-button-disabled | Whether to disable 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` | - | - |
|
| displayed-coupon-index | Index of displayed coupon | `Number` | - | - |
|
||||||
| close-button-text | Close button text | `String` | `Close` | - |
|
| close-button-text | Close button text | `String` | `Close` | - |
|
||||||
| disabled-list-title | Disabled list title | `String` | `Unavailable` | - |
|
| disabled-list-title | Disabled list title | `String` | `Unavailable` | - |
|
||||||
|
@ -85,6 +85,7 @@ export default {
|
|||||||
| disabled-doupons | 不可用优惠券列表 | `Array` | `[]` | - |
|
| disabled-doupons | 不可用优惠券列表 | `Array` | `[]` | - |
|
||||||
| exchange-button-text | 兑换按钮文字 | `String` | `兑换` | - |
|
| exchange-button-text | 兑换按钮文字 | `String` | `兑换` | - |
|
||||||
| exchange-button-disabled | 是否禁用兑换按钮 | `Boolean` | `false` | - |
|
| exchange-button-disabled | 是否禁用兑换按钮 | `Boolean` | `false` | - |
|
||||||
|
| exchange-min-length | 兑换码最小长度 | `Number` | `1` | - |
|
||||||
| displayed-coupon-index | 滚动至特定优惠券位置 | `Number` | - | - |
|
| displayed-coupon-index | 滚动至特定优惠券位置 | `Number` | - | - |
|
||||||
| show-close-button | 是否显示列表底部按钮 | `Boolean` | `true` | - |
|
| show-close-button | 是否显示列表底部按钮 | `Boolean` | `true` | - |
|
||||||
| close-button-text | 列表底部按钮文字 | `String` | `不使用优惠` | - |
|
| close-button-text | 列表底部按钮文字 | `String` | `不使用优惠` | - |
|
||||||
|
@ -11,11 +11,10 @@
|
|||||||
size="small"
|
size="small"
|
||||||
type="danger"
|
type="danger"
|
||||||
class="van-coupon-list__exchange"
|
class="van-coupon-list__exchange"
|
||||||
:disabled="exchangeButtonDisabled || !exchangeCode.length"
|
:text="exchangeButtonText || $t('exchange')"
|
||||||
|
:disabled="buttonDisabled"
|
||||||
@click="onClickExchangeButton"
|
@click="onClickExchangeButton"
|
||||||
>
|
/>
|
||||||
{{ exchangeButtonText || $t('exchange') }}
|
|
||||||
</van-button>
|
|
||||||
</cell-group>
|
</cell-group>
|
||||||
<div class="van-coupon-list__list" :class="{ 'van-coupon-list--with-exchange': showExchangeBar }" ref="list">
|
<div class="van-coupon-list__list" :class="{ 'van-coupon-list--with-exchange': showExchangeBar }" ref="list">
|
||||||
<coupon-item
|
<coupon-item
|
||||||
@ -40,11 +39,10 @@
|
|||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
v-show="showCloseButton"
|
v-show="showCloseButton"
|
||||||
|
v-text="closeButtonText || $t('close')"
|
||||||
class="van-coupon-list__close van-hairline--top"
|
class="van-coupon-list__close van-hairline--top"
|
||||||
@click="onClickNotUse"
|
@click="onClickNotUse"
|
||||||
>
|
/>
|
||||||
{{ closeButtonText || $t('close') }}
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@ -74,6 +72,11 @@ export default create({
|
|||||||
inputPlaceholder: String,
|
inputPlaceholder: String,
|
||||||
disabledListTitle: String,
|
disabledListTitle: String,
|
||||||
exchangeButtonText: String,
|
exchangeButtonText: String,
|
||||||
|
exchangeButtonDisabled: Boolean,
|
||||||
|
exchangeMinLength: {
|
||||||
|
type: Number,
|
||||||
|
default: 1
|
||||||
|
},
|
||||||
chosenCoupon: {
|
chosenCoupon: {
|
||||||
type: Number,
|
type: Number,
|
||||||
default: -1
|
default: -1
|
||||||
@ -86,10 +89,6 @@ export default create({
|
|||||||
type: Array,
|
type: Array,
|
||||||
default: () => []
|
default: () => []
|
||||||
},
|
},
|
||||||
exchangeButtonDisabled: {
|
|
||||||
type: Boolean,
|
|
||||||
default: false
|
|
||||||
},
|
|
||||||
displayedCouponIndex: {
|
displayedCouponIndex: {
|
||||||
type: Number,
|
type: Number,
|
||||||
default: -1
|
default: -1
|
||||||
@ -104,18 +103,24 @@ export default create({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
watch: {
|
|
||||||
displayedCouponIndex(val) {
|
|
||||||
this.scrollToShowCoupon(val);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
exchangeCode: ''
|
exchangeCode: ''
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
|
computed: {
|
||||||
|
buttonDisabled() {
|
||||||
|
return this.exchangeButtonDisabled || this.exchangeCode.length < this.exchangeMinLength;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
watch: {
|
||||||
|
displayedCouponIndex(val) {
|
||||||
|
this.scrollToShowCoupon(val);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
mounted() {
|
mounted() {
|
||||||
this.scrollToShowCoupon(this.displayedCouponIndex);
|
this.scrollToShowCoupon(this.displayedCouponIndex);
|
||||||
},
|
},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user