|
|
@@ -1,10 +1,26 @@
|
|
|
<template>
|
|
|
- <nut-swiper-item @touchstart="onTouchStart" @touchmove="onTouchMove" @touchend="onTouchEnd" @touchcancel="onTouchEnd">
|
|
|
- <view :style="imageStyle" class="nut-imagepreview-box" v-if="image && image.src">
|
|
|
+ <nut-swiper-item @click="closeSwiper">
|
|
|
+ <view
|
|
|
+ :style="imageStyle"
|
|
|
+ class="nut-imagepreview-box"
|
|
|
+ v-if="image && image.src"
|
|
|
+ @touchstart="onTouchStart"
|
|
|
+ @touchmove="onTouchMove"
|
|
|
+ @touchend="onTouchEnd"
|
|
|
+ @touchcancel="onTouchEnd"
|
|
|
+ >
|
|
|
<img :src="image.src" class="nut-imagepreview-img" @load="imageLoad" />
|
|
|
</view>
|
|
|
|
|
|
- <view class="nut-imagepreview-box" v-if="video && video.source">
|
|
|
+ <view
|
|
|
+ class="nut-imagepreview-box"
|
|
|
+ v-if="video && video.source"
|
|
|
+ @click="videoClick"
|
|
|
+ @touchstart="onTouchStart"
|
|
|
+ @touchmove="onTouchMove"
|
|
|
+ @touchend="onTouchEnd"
|
|
|
+ @touchcancel="onTouchEnd"
|
|
|
+ >
|
|
|
<nut-video :source="video.source" :options="video.options"></nut-video>
|
|
|
</view>
|
|
|
</nut-swiper-item>
|
|
|
@@ -215,6 +231,9 @@ export default create({
|
|
|
};
|
|
|
|
|
|
const checkTap = () => {
|
|
|
+ if (fingerNum == 1 && props.video && props.video.source) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
if (fingerNum > 1) {
|
|
|
return;
|
|
|
}
|
|
|
@@ -239,6 +258,7 @@ export default create({
|
|
|
};
|
|
|
|
|
|
const onTouchEnd = (event: TouchEvent) => {
|
|
|
+ console.log('ontauchend');
|
|
|
let stopPropagation = false;
|
|
|
|
|
|
/* istanbul ignore else */
|
|
|
@@ -291,6 +311,13 @@ export default create({
|
|
|
|
|
|
const clamp = (num: number, min: number, max: number): number => Math.min(Math.max(num, min), max);
|
|
|
|
|
|
+ // 视频点击
|
|
|
+ const closeSwiper = (event: any) => {
|
|
|
+ console.log('关闭视频');
|
|
|
+ // event.preventDefault();
|
|
|
+ emit('close');
|
|
|
+ };
|
|
|
+
|
|
|
watch(() => props.initNo, resetScale);
|
|
|
watch(
|
|
|
() => props.show,
|
|
|
@@ -308,7 +335,8 @@ export default create({
|
|
|
onTouchEnd,
|
|
|
getDistance,
|
|
|
imageStyle,
|
|
|
- imageLoad
|
|
|
+ imageLoad,
|
|
|
+ closeSwiper
|
|
|
};
|
|
|
}
|
|
|
});
|