mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-23 18:00:27 +08:00
types(CouponList): use tsx (#8118)
This commit is contained in:
parent
38e3bc948d
commit
708d57ea77
@ -1,4 +1,4 @@
|
|||||||
import { watch, computed, nextTick, onMounted, reactive } from 'vue';
|
import { watch, computed, nextTick, reactive, PropType, onMounted } from 'vue';
|
||||||
|
|
||||||
// Utils
|
// Utils
|
||||||
import { createNamespace } from '../utils';
|
import { createNamespace } from '../utils';
|
||||||
@ -12,14 +12,13 @@ import Tab from '../tab';
|
|||||||
import Tabs from '../tabs';
|
import Tabs from '../tabs';
|
||||||
import Field from '../field';
|
import Field from '../field';
|
||||||
import Button from '../button';
|
import Button from '../button';
|
||||||
import Coupon from '../coupon';
|
import Coupon, { CouponInfo } from '../coupon';
|
||||||
|
|
||||||
const [createComponent, bem, t] = createNamespace('coupon-list');
|
const [createComponent, bem, t] = createNamespace('coupon-list');
|
||||||
const EMPTY_IMAGE = 'https://img01.yzcdn.cn/vant/coupon-empty.png';
|
const EMPTY_IMAGE = 'https://img01.yzcdn.cn/vant/coupon-empty.png';
|
||||||
|
|
||||||
export default createComponent({
|
export default createComponent({
|
||||||
props: {
|
props: {
|
||||||
code: String,
|
|
||||||
enabledTitle: String,
|
enabledTitle: String,
|
||||||
disabledTitle: String,
|
disabledTitle: String,
|
||||||
closeButtonText: String,
|
closeButtonText: String,
|
||||||
@ -27,6 +26,10 @@ export default createComponent({
|
|||||||
exchangeButtonText: String,
|
exchangeButtonText: String,
|
||||||
exchangeButtonLoading: Boolean,
|
exchangeButtonLoading: Boolean,
|
||||||
exchangeButtonDisabled: Boolean,
|
exchangeButtonDisabled: Boolean,
|
||||||
|
code: {
|
||||||
|
type: String,
|
||||||
|
default: '',
|
||||||
|
},
|
||||||
exchangeMinLength: {
|
exchangeMinLength: {
|
||||||
type: Number,
|
type: Number,
|
||||||
default: 1,
|
default: 1,
|
||||||
@ -36,11 +39,11 @@ export default createComponent({
|
|||||||
default: -1,
|
default: -1,
|
||||||
},
|
},
|
||||||
coupons: {
|
coupons: {
|
||||||
type: Array,
|
type: Array as PropType<CouponInfo[]>,
|
||||||
default: () => [],
|
default: () => [],
|
||||||
},
|
},
|
||||||
disabledCoupons: {
|
disabledCoupons: {
|
||||||
type: Array,
|
type: Array as PropType<CouponInfo[]>,
|
||||||
default: () => [],
|
default: () => [],
|
||||||
},
|
},
|
||||||
displayedCouponIndex: {
|
displayedCouponIndex: {
|
||||||
@ -76,7 +79,7 @@ export default createComponent({
|
|||||||
|
|
||||||
const state = reactive({
|
const state = reactive({
|
||||||
tab: 0,
|
tab: 0,
|
||||||
code: props.code || '',
|
code: props.code,
|
||||||
});
|
});
|
||||||
|
|
||||||
const { height: windowHeight } = useWindowSize();
|
const { height: windowHeight } = useWindowSize();
|
||||||
@ -102,7 +105,7 @@ export default createComponent({
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const scrollToCoupon = (index) => {
|
const scrollToCoupon = (index: number) => {
|
||||||
nextTick(() => {
|
nextTick(() => {
|
||||||
if (couponRefs.value[index]) {
|
if (couponRefs.value[index]) {
|
||||||
couponRefs.value[index].scrollIntoView();
|
couponRefs.value[index].scrollIntoView();
|
Loading…
x
Reference in New Issue
Block a user