chore: add trailingComma

This commit is contained in:
陈嘉涵
2020-01-19 11:57:09 +08:00
parent e841175fe8
commit 389d68884d
269 changed files with 2706 additions and 2702 deletions
+14 -14
View File
@@ -33,25 +33,25 @@ export default {
coupon: {
name: '优惠券名称',
reason: '优惠券不可用原因',
description: '描述信息'
description: '描述信息',
},
exchange: '兑换成功'
exchange: '兑换成功',
},
'en-US': {
coupon: {
name: 'Coupon name',
reason: 'Coupon unavailable reason',
description: 'Description'
description: 'Description',
},
exchange: 'Success'
}
exchange: 'Success',
},
},
data() {
return {
showList: false,
chosenCoupon: -1,
exchangedCoupons: []
exchangedCoupons: [],
};
},
@@ -75,7 +75,7 @@ export default {
startAt: 1489104000,
endAt: 1514592000,
valueDesc: '1.5',
unitDesc: '元'
unitDesc: '元',
};
},
@@ -85,7 +85,7 @@ export default {
id: 2,
value: 12,
valueDesc: '8.8',
unitDesc: '折'
unitDesc: '折',
};
},
@@ -93,7 +93,7 @@ export default {
return {
...this.coupon,
id: 3,
reason: this.$t('coupon.reason')
reason: this.$t('coupon.reason'),
};
},
@@ -103,9 +103,9 @@ export default {
valueDesc: '1',
unitDesc: '折',
id: 4,
reason: this.$t('coupon.reason')
reason: this.$t('coupon.reason'),
};
}
},
},
methods: {
@@ -117,12 +117,12 @@ export default {
this.$toast(this.$t('exchange'));
this.exchangedCoupons.push({
...this.coupon,
id: this.randomId()
id: this.randomId(),
});
},
randomId(max = 999999) {
return Math.floor(Math.random() * max) + 1;
}
}
},
},
};
</script>
+18 -18
View File
@@ -10,7 +10,7 @@ const EMPTY_IMAGE = 'https://img.yzcdn.cn/vant/coupon-empty.png';
export default createComponent({
model: {
prop: 'code'
prop: 'code',
},
props: {
@@ -24,51 +24,51 @@ export default createComponent({
exchangeButtonDisabled: Boolean,
exchangeMinLength: {
type: Number,
default: 1
default: 1,
},
chosenCoupon: {
type: Number,
default: -1
default: -1,
},
coupons: {
type: Array,
default: () => []
default: () => [],
},
disabledCoupons: {
type: Array,
default: () => []
default: () => [],
},
displayedCouponIndex: {
type: Number,
default: -1
default: -1,
},
showExchangeBar: {
type: Boolean,
default: true
default: true,
},
showCloseButton: {
type: Boolean,
default: true
default: true,
},
showCount: {
type: Boolean,
default: true
default: true,
},
currency: {
type: String,
default: '¥'
default: '¥',
},
emptyImage: {
type: String,
default: EMPTY_IMAGE
}
default: EMPTY_IMAGE,
},
},
data() {
return {
tab: 0,
winHeight: window.innerHeight,
currentCode: this.code || ''
currentCode: this.code || '',
};
},
@@ -84,9 +84,9 @@ export default createComponent({
listStyle() {
return {
height: this.winHeight - (this.showExchangeBar ? 140 : 94) + 'px'
height: this.winHeight - (this.showExchangeBar ? 140 : 94) + 'px',
};
}
},
},
watch: {
@@ -98,7 +98,7 @@ export default createComponent({
this.$emit('input', code);
},
displayedCouponIndex: 'scrollToShowCoupon'
displayedCouponIndex: 'scrollToShowCoupon',
},
mounted() {
@@ -152,7 +152,7 @@ export default createComponent({
onClick={this.onClickExchangeButton}
/>
);
}
},
},
render() {
@@ -234,5 +234,5 @@ export default createComponent({
</div>
</div>
);
}
},
});
+22 -22
View File
@@ -13,17 +13,17 @@ const coupon = {
name: 'name',
description: 'description',
startAt: 1489104000,
endAt: 1514592000
endAt: 1514592000,
};
const coupon2 = {
...coupon,
denominations: 100
denominations: 100,
};
const coupon3 = {
...coupon,
denominations: 123
denominations: 123,
};
const emptyCoupon = {
@@ -32,7 +32,7 @@ const emptyCoupon = {
denominations: 0,
originCondition: 0,
startAt: 1489104000,
endAt: 1514592000
endAt: 1514592000,
};
const discountCoupon = {
@@ -42,7 +42,7 @@ const discountCoupon = {
denominations: 0,
originCondition: 50,
value: 12,
description: ''
description: '',
};
const discountCoupon2 = {
@@ -52,28 +52,28 @@ const discountCoupon2 = {
denominations: 0,
originCondition: 50,
value: 12,
description: ''
description: '',
};
const disabledCoupon = {
...coupon,
id: 3,
reason: 'reason'
reason: 'reason',
};
const disabledDiscountCoupon = {
...discountCoupon,
discount: 10,
id: 4,
reason: ''
reason: '',
};
test('render disabled coupon', () => {
const wrapper = mount(Coupon, {
propsData: {
coupon: disabledCoupon,
disabled: true
}
disabled: true,
},
});
expect(wrapper).toMatchSnapshot();
@@ -84,8 +84,8 @@ test('render coupon list', async () => {
propsData: {
chosenCoupon: 1,
coupons: [emptyCoupon, coupon, coupon2, coupon3, discountCoupon, discountCoupon2],
disabledCoupons: [disabledCoupon, disabledDiscountCoupon]
}
disabledCoupons: [disabledCoupon, disabledDiscountCoupon],
},
});
await later();
expect(wrapper).toMatchSnapshot();
@@ -95,8 +95,8 @@ test('render empty coupon list', () => {
const wrapper = mount(CouponList, {
propsData: {
coupons: [],
disabledCoupons: []
}
disabledCoupons: [],
},
});
wrapper.findAll('.van-tab').at(1).trigger('click');
expect(wrapper).toMatchSnapshot();
@@ -105,8 +105,8 @@ test('render empty coupon list', () => {
test('empty-image prop', () => {
const wrapper = mount(CouponList, {
propsData: {
emptyImage: 'https://img.yzcdn.com/xxx.png'
}
emptyImage: 'https://img.yzcdn.com/xxx.png',
},
});
expect(wrapper).toMatchSnapshot();
@@ -118,7 +118,7 @@ test('exchange coupon', () => {
wrapper.setData({
currentCode: '1',
displayedCouponIndex: 1
displayedCouponIndex: 1,
});
exchange.trigger('click');
wrapper.setProps({ code: '2' });
@@ -136,9 +136,9 @@ test('render coupon cell', () => {
const wrapper = mount(CouponCell, {
context: {
on: {
click: onClick
}
}
click: onClick,
},
},
});
expect(wrapper).toMatchSnapshot();
@@ -150,8 +150,8 @@ test('render coupon cell with coupon', () => {
const wrapper = mount(CouponCell, {
propsData: {
coupons: [{ value: 100 }],
chosenCoupon: 0
}
chosenCoupon: 0,
},
});
expect(wrapper).toMatchSnapshot();
});