1
0
mirror of https://gitee.com/vant-contrib/vant.git synced 2025-04-06 03:57:59 +08:00

[improvement] ImagePreview: add fade transition ()

This commit is contained in:
neverland 2018-12-01 08:46:42 +08:00 committed by GitHub
parent 66c940d672
commit d14f9cb5dc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 41 additions and 37 deletions
packages/image-preview

@ -1,4 +1,5 @@
<template>
<transition name="van-fade">
<div
v-if="value"
:class="b()"
@ -36,6 +37,7 @@
</swipe-item>
</swipe>
</div>
</transition>
</template>
<script>
@ -176,7 +178,7 @@ export default create({
onTouchStart(event) {
const { touches } = event;
const { offsetX } = this.$refs.swipe;
const { offsetX = 0 } = this.$refs.swipe || {};
if (touches.length === 1 && this.scale !== 1) {
this.startMove(event);

@ -1,7 +1,7 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`render image 1`] = `
<div class="van-image-preview">
<div class="van-image-preview" name="van-fade">
<div class="van-image-preview__index">
1/3
</div>
@ -23,7 +23,7 @@ exports[`render image 1`] = `
`;
exports[`zoom 1`] = `
<div class="van-image-preview">
<div class="van-image-preview" name="van-fade">
<div class="van-image-preview__index">
1/3
</div>

@ -1,7 +1,9 @@
import Vue from 'vue';
import ImagePreview from '..';
import ImagePreviewVue from '../ImagePreview';
import { mount, trigger, triggerDrag } from '../../../test/utils';
import { mount, trigger, triggerDrag, transitionStub } from '../../../test/utils';
transitionStub();
function triggerZoom(el, x, y) {
trigger(el, 'touchstart', 0, 0, { x, y });