[new feature] SwipeCell: add stop-propagation prop (#3952)

This commit is contained in:
neverland 2019-07-24 20:27:56 +08:00 committed by GitHub
parent 632e4c1d31
commit 04616b8a5f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 1 deletions

View File

@ -77,6 +77,7 @@ export default {
| disabled | Whether to disabled swipe | `boolean` | `false` | | disabled | Whether to disabled swipe | `boolean` | `false` |
| left-width | Width of the left swipe area | `number` | `auto` | | left-width | Width of the left swipe area | `number` | `auto` |
| right-width | Width of the right 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 ### Slots

View File

@ -82,6 +82,7 @@ export default {
| disabled | 是否禁用滑动 | `boolean` | `false` | - | | disabled | 是否禁用滑动 | `boolean` | `false` | - |
| left-width | 指定左侧滑动区域宽度 | `number` | `auto` | - | | left-width | 指定左侧滑动区域宽度 | `number` | `auto` | - |
| right-width | 指定右侧滑动区域宽度 | `number` | `auto` | - | | right-width | 指定右侧滑动区域宽度 | `number` | `auto` | - |
| stop-propagation | 是否阻止滑动事件冒泡 | `boolean` | `false` | 2.1.0 |
### Slots ### Slots

View File

@ -21,6 +21,7 @@ export default createComponent({
disabled: Boolean, disabled: Boolean,
leftWidth: Number, leftWidth: Number,
rightWidth: Number, rightWidth: Number,
stopPropagation: Boolean,
name: { name: {
type: [Number, String], type: [Number, String],
default: '' default: ''
@ -121,7 +122,7 @@ export default createComponent({
this.touchMove(event); this.touchMove(event);
if (this.direction === 'horizontal') { if (this.direction === 'horizontal') {
preventDefault(event, true); preventDefault(event, this.stopPropagation);
this.swipeMove(this.deltaX + this.startOffset); this.swipeMove(this.deltaX + this.startOffset);
} }
}, },