[new feature] ImagePreview support startPosition (#286)

* [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

* [bugfix] NoticeBar text disappeared when page back

* [new feature] ImagePreview support startPosition

* fix: improve imagePreview test cases
This commit is contained in:
neverland
2017-11-07 02:22:17 -06:00
committed by GitHub
parent 6984f9db55
commit 6c37a6906f
5 changed files with 41 additions and 7 deletions

View File

@@ -7,7 +7,7 @@
@touchend="onTouchEnd"
@touchcancel="onTouchEnd"
>
<van-swipe>
<van-swipe :initialSwipe="startPosition">
<van-swipe-item v-for="(item, index) in images" :key="index">
<img class="van-image-preview__image" :src="item" >
</van-swipe-item>
@@ -44,7 +44,8 @@ export default {
data() {
return {
images: []
images: [],
startPosition: 0
};
},
@@ -63,7 +64,8 @@ export default {
this.deltaY = event.touches[0].clientY - this.touchStartY;
},
onTouchEnd() {
onTouchEnd(event) {
event.preventDefault();
// prevent long tap to close component
const deltaTime = new Date() - this.touchStartTime;
if (deltaTime < 100 && Math.abs(this.deltaX) < 20 && Math.abs(this.deltaY) < 20) {