mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
feat(Swipe): add stop-propagation prop (#4972)
This commit is contained in:
parent
5040233234
commit
aa0dfe8808
@ -130,14 +130,15 @@ export default {
|
||||
|------|------|------|------|------|
|
||||
| autoplay | Autoplay interval (ms) | *number* | - | - |
|
||||
| duration | Animation duration (ms) | *number* | `500` | - |
|
||||
| loop | Whether to enable loop | *boolean* | `true` | - |
|
||||
| vertical | Vertical Scrolling | *boolean* | `false` | - |
|
||||
| touchable | Whether to allow swipe by touch gesture | *boolean* | `true` | - |
|
||||
| show-indicators | Whether to show indicators | *boolean* | `true` | - |
|
||||
| indicator-color | Indicator color | *string* | `#1989fa` | - |
|
||||
| initial-swipe | Index of initial swipe, start from 0 | *number* | `0` | - |
|
||||
| width | Set Swiper Item Width | *number* | `0` | - |
|
||||
| height | Set Swiper Item Height | *number* | `0` | - |
|
||||
| loop | Whether to enable loop | *boolean* | `true` | - |
|
||||
| show-indicators | Whether to show indicators | *boolean* | `true` | - |
|
||||
| indicator-color | Indicator color | *string* | `#1989fa` | - |
|
||||
| vertical | Whether to be vertical Scrolling | *boolean* | `false` | - |
|
||||
| touchable | Whether to allow swipe by touch gesture | *boolean* | `true` | - |
|
||||
| stop-propagation | Whether to stop touchmove event propagation | *boolean* | `false` | 2.1.0 |
|
||||
|
||||
### Swipe Events
|
||||
|
||||
|
@ -137,13 +137,14 @@ export default {
|
||||
| autoplay | 自动轮播间隔,单位为 ms | *number* | - | - |
|
||||
| duration | 动画时长,单位为 ms | *number* | `500` | - |
|
||||
| initial-swipe | 初始位置索引值 | *number* | `0` | - |
|
||||
| width | 滑块宽度 | *number* | `auto` | - |
|
||||
| height | 滑块高度 | *number* | `auto` | - |
|
||||
| loop | 是否开启循环播放 | *boolean* | `true` | - |
|
||||
| show-indicators | 是否显示指示器 | *boolean* | `true` | - |
|
||||
| indicator-color | 指示器颜色 | *string* | `#1989fa` | - |
|
||||
| vertical | 是否为纵向滚动 | *boolean* | `false` | - |
|
||||
| touchable | 是否可以通过手势滑动 | *boolean* | `true` | - |
|
||||
| width | 滑块宽度 | *number* | `auto` | - |
|
||||
| height | 滑块高度 | *number* | `auto` | - |
|
||||
| stop-propagation | 是否阻止滑动事件冒泡 | *boolean* | `true` | 2.2.13 |
|
||||
|
||||
### Swipe Events
|
||||
|
||||
|
@ -46,6 +46,10 @@ export default createComponent({
|
||||
showIndicators: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
stopPropagation: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
}
|
||||
},
|
||||
|
||||
@ -169,7 +173,7 @@ export default createComponent({
|
||||
this.touchMove(event);
|
||||
|
||||
if (this.isCorrectDirection) {
|
||||
preventDefault(event, true);
|
||||
preventDefault(event, this.stopPropagation);
|
||||
this.move({ offset: this.delta });
|
||||
}
|
||||
},
|
||||
|
Loading…
x
Reference in New Issue
Block a user