[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:
neverland
2017-11-03 04:50:58 -05:00
committed by GitHub
parent 7a3fef0a09
commit 74a3eea203
3 changed files with 9 additions and 3 deletions

View File

@@ -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;
});