From 04616b8a5fa6c9d85ed64be9fc8a12db5a7eb347 Mon Sep 17 00:00:00 2001 From: neverland Date: Wed, 24 Jul 2019 20:27:56 +0800 Subject: [PATCH] [new feature] SwipeCell: add stop-propagation prop (#3952) --- src/swipe-cell/README.md | 1 + src/swipe-cell/README.zh-CN.md | 1 + src/swipe-cell/index.js | 3 ++- 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/swipe-cell/README.md b/src/swipe-cell/README.md index e537de4c5..8925c4034 100644 --- a/src/swipe-cell/README.md +++ b/src/swipe-cell/README.md @@ -77,6 +77,7 @@ export default { | disabled | Whether to disabled swipe | `boolean` | `false` | | left-width | Width of the left swipe area | `number` | `auto` | | right-width | Width of the right swipe area | `number` | `auto` | +| stop-propagation | Whether to stop touchmove event propagation | `boolean` | `false` | ### Slots diff --git a/src/swipe-cell/README.zh-CN.md b/src/swipe-cell/README.zh-CN.md index 18a965374..eaec2fd59 100644 --- a/src/swipe-cell/README.zh-CN.md +++ b/src/swipe-cell/README.zh-CN.md @@ -82,6 +82,7 @@ export default { | disabled | 是否禁用滑动 | `boolean` | `false` | - | | left-width | 指定左侧滑动区域宽度 | `number` | `auto` | - | | right-width | 指定右侧滑动区域宽度 | `number` | `auto` | - | +| stop-propagation | 是否阻止滑动事件冒泡 | `boolean` | `false` | 2.1.0 | ### Slots diff --git a/src/swipe-cell/index.js b/src/swipe-cell/index.js index 96cdb847f..0bc9b2c0e 100644 --- a/src/swipe-cell/index.js +++ b/src/swipe-cell/index.js @@ -21,6 +21,7 @@ export default createComponent({ disabled: Boolean, leftWidth: Number, rightWidth: Number, + stopPropagation: Boolean, name: { type: [Number, String], default: '' @@ -121,7 +122,7 @@ export default createComponent({ this.touchMove(event); if (this.direction === 'horizontal') { - preventDefault(event, true); + preventDefault(event, this.stopPropagation); this.swipeMove(this.deltaX + this.startOffset); } },