mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
[improvement]SwipeCell: add disabled prop (#1884)
This commit is contained in:
parent
93d8c809f9
commit
a6d4d2d74a
@ -63,6 +63,7 @@ export default {
|
||||
| left-width | Width of the left scrollable area | `Number` | `0` |
|
||||
| right-width | Width of the right scrollable area | `Number` | `0` |
|
||||
| on-close | Callback function before close | `Function` | - |
|
||||
| disabled | Whether to disabled swipe | `Boolean` | `false` |
|
||||
|
||||
### Slot
|
||||
|
||||
|
@ -38,6 +38,7 @@ export default create({
|
||||
|
||||
props: {
|
||||
onClose: Function,
|
||||
disabled: Boolean,
|
||||
leftWidth: {
|
||||
type: Number,
|
||||
default: 0
|
||||
@ -106,6 +107,10 @@ export default create({
|
||||
},
|
||||
|
||||
startDrag(event) {
|
||||
if (this.disabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.draging = true;
|
||||
this.touchStart(event);
|
||||
|
||||
@ -115,6 +120,10 @@ export default create({
|
||||
},
|
||||
|
||||
onDrag(event) {
|
||||
if (this.disabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.touchMove(event);
|
||||
const { deltaX } = this;
|
||||
|
||||
@ -130,6 +139,10 @@ export default create({
|
||||
},
|
||||
|
||||
endDrag() {
|
||||
if (this.disabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.draging = false;
|
||||
if (this.swiping) {
|
||||
this.swipeLeaveTransition(this.offset > 0 ? -1 : 1);
|
||||
|
@ -63,6 +63,7 @@ export default {
|
||||
| left-width | 左侧滑动区域宽度 | `Number` | `0` |
|
||||
| right-width | 右侧滑动区域宽度 | `Number` | `0` |
|
||||
| on-close | 关闭时的回调函数 | `Function` | - |
|
||||
| disabled | 是否禁用滑动 | `Boolean` | `false` |
|
||||
|
||||
### Slot
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user