mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-24 10:20:19 +08:00
[bugfix] ImagePreview: should lock scroll (#3645)
This commit is contained in:
parent
344b105e0e
commit
707729a544
@ -165,7 +165,7 @@ export default sfc({
|
|||||||
this.startDistance = getDistance(event.touches);
|
this.startDistance = getDistance(event.touches);
|
||||||
},
|
},
|
||||||
|
|
||||||
onTouchStart(event) {
|
onImageTouchStart(event) {
|
||||||
const { touches } = event;
|
const { touches } = event;
|
||||||
const { offsetX = 0 } = this.$refs.swipe || {};
|
const { offsetX = 0 } = this.$refs.swipe || {};
|
||||||
|
|
||||||
@ -176,7 +176,7 @@ export default sfc({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
onTouchMove(event) {
|
onImageTouchMove(event) {
|
||||||
const { touches } = event;
|
const { touches } = event;
|
||||||
if (this.moving || this.zooming) {
|
if (this.moving || this.zooming) {
|
||||||
preventDefault(event, true);
|
preventDefault(event, true);
|
||||||
@ -197,7 +197,7 @@ export default sfc({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
onTouchEnd(event) {
|
onImageTouchEnd(event) {
|
||||||
/* istanbul ignore else */
|
/* istanbul ignore else */
|
||||||
if (this.moving || this.zooming) {
|
if (this.moving || this.zooming) {
|
||||||
let stopPropagation = true;
|
let stopPropagation = true;
|
||||||
@ -268,10 +268,10 @@ export default sfc({
|
|||||||
class: bem('image'),
|
class: bem('image'),
|
||||||
style: index === active ? this.imageStyle : null,
|
style: index === active ? this.imageStyle : null,
|
||||||
on: {
|
on: {
|
||||||
touchstart: this.onTouchStart,
|
touchstart: this.onImageTouchStart,
|
||||||
touchmove: this.onTouchMove,
|
touchmove: this.onImageTouchMove,
|
||||||
touchend: this.onTouchEnd,
|
touchend: this.onImageTouchEnd,
|
||||||
touchcancel: this.onTouchEnd
|
touchcancel: this.onImageTouchEnd
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
return (
|
return (
|
||||||
@ -292,6 +292,7 @@ export default sfc({
|
|||||||
<div
|
<div
|
||||||
class={[bem(), this.className]}
|
class={[bem(), this.className]}
|
||||||
onTouchstart={this.onWrapperTouchStart}
|
onTouchstart={this.onWrapperTouchStart}
|
||||||
|
onTouchMove={preventDefault}
|
||||||
onTouchend={this.onWrapperTouchEnd}
|
onTouchend={this.onWrapperTouchEnd}
|
||||||
onTouchcancel={this.onWrapperTouchEnd}
|
onTouchcancel={this.onWrapperTouchEnd}
|
||||||
>
|
>
|
||||||
|
@ -124,7 +124,7 @@ export default {
|
|||||||
| name | 标识符,可以在回调函数的第二项参数中获取 | `String` | - | 1.6.13 |
|
| name | 标识符,可以在回调函数的第二项参数中获取 | `String` | - | 1.6.13 |
|
||||||
| accept | 接受的文件类型 | `String` | `image/*` | - |
|
| accept | 接受的文件类型 | `String` | `image/*` | - |
|
||||||
| preview-image | 是否在上传完成后展示预览图 | `Boolean` | `true` | 2.0.0 |
|
| preview-image | 是否在上传完成后展示预览图 | `Boolean` | `true` | 2.0.0 |
|
||||||
| preview-size | 预览图和上传区域的尺寸,单位为`px` | `String | Number` | `80px` | 2.0.0 |
|
| preview-size | 预览图和上传区域的尺寸,默认单位为`px` | `String | Number` | `80px` | 2.0.0 |
|
||||||
| multiple | 是否开启图片多选,部分安卓机型不支持 | `Boolean` | `false` | 2.0.0 |
|
| multiple | 是否开启图片多选,部分安卓机型不支持 | `Boolean` | `false` | 2.0.0 |
|
||||||
| disabled | 是否禁用文件上传 | `Boolean` | `false` | - |
|
| disabled | 是否禁用文件上传 | `Boolean` | `false` | - |
|
||||||
| capture | 图片选取模式,可选值为`camera`(直接调起摄像头) | `String` | - | 2.0.0 |
|
| capture | 图片选取模式,可选值为`camera`(直接调起摄像头) | `String` | - | 2.0.0 |
|
||||||
|
Loading…
x
Reference in New Issue
Block a user