mirror of
https://github.com/youzan/vant.git
synced 2025-10-19 18:14:13 +00:00
[new feature] Swipe add 'initialSwipe' prop (#279)
* [bugfix] CouponList always show empty info * [bugfix] add click feedback of buttons in components * [Doc] add custom theme document * [new feature] Notice bar support more props * [bugfix] PullRefresh test cases * [bugfix] unused NoticeBar style * [bugfix] Swipe width calc error * [Doc] english document of all action components * [Doc] change document site path to /zanui/vant * [Doc] fix * [bugfix] uploader style error * [bugfix] tabs document demo * [new feature] Cell support vue-router target route * [bugfix] add cell test cases * update yarn.lock * [bugfix] Tabbar cann't display info when use icon slot * [Doc] update document title * [bugfix] Dialog should reset button text when showed * [new feature] CouponList add showCloseButton prop * [new feature] Swipe add 'initialSwipe' prop
This commit is contained in:
@@ -30,6 +30,10 @@ export default {
|
||||
|
||||
props: {
|
||||
autoplay: Number,
|
||||
initialSwipe: {
|
||||
type: Number,
|
||||
default: 0
|
||||
},
|
||||
showIndicators: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
@@ -92,9 +96,9 @@ export default {
|
||||
// reset offset when children changes
|
||||
clearTimeout(this.timer);
|
||||
this.width = this.$el.getBoundingClientRect().width;
|
||||
this.active = 0;
|
||||
this.active = this.initialSwipe;
|
||||
this.currentDuration = 0;
|
||||
this.offset = this.count > 1 ? -this.width : 0;
|
||||
this.offset = this.count > 1 ? -this.width * (this.active + 1) : 0;
|
||||
this.swipes.forEach(swipe => {
|
||||
swipe.offset = 0;
|
||||
});
|
||||
|
Reference in New Issue
Block a user