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` |
|
| left-width | Width of the left scrollable area | `Number` | `0` |
|
||||||
| right-width | Width of the right scrollable area | `Number` | `0` |
|
| right-width | Width of the right scrollable area | `Number` | `0` |
|
||||||
| on-close | Callback function before close | `Function` | - |
|
| on-close | Callback function before close | `Function` | - |
|
||||||
|
| disabled | Whether to disabled swipe | `Boolean` | `false` |
|
||||||
|
|
||||||
### Slot
|
### Slot
|
||||||
|
|
||||||
|
@ -38,6 +38,7 @@ export default create({
|
|||||||
|
|
||||||
props: {
|
props: {
|
||||||
onClose: Function,
|
onClose: Function,
|
||||||
|
disabled: Boolean,
|
||||||
leftWidth: {
|
leftWidth: {
|
||||||
type: Number,
|
type: Number,
|
||||||
default: 0
|
default: 0
|
||||||
@ -106,6 +107,10 @@ export default create({
|
|||||||
},
|
},
|
||||||
|
|
||||||
startDrag(event) {
|
startDrag(event) {
|
||||||
|
if (this.disabled) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
this.draging = true;
|
this.draging = true;
|
||||||
this.touchStart(event);
|
this.touchStart(event);
|
||||||
|
|
||||||
@ -115,6 +120,10 @@ export default create({
|
|||||||
},
|
},
|
||||||
|
|
||||||
onDrag(event) {
|
onDrag(event) {
|
||||||
|
if (this.disabled) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
this.touchMove(event);
|
this.touchMove(event);
|
||||||
const { deltaX } = this;
|
const { deltaX } = this;
|
||||||
|
|
||||||
@ -130,6 +139,10 @@ export default create({
|
|||||||
},
|
},
|
||||||
|
|
||||||
endDrag() {
|
endDrag() {
|
||||||
|
if (this.disabled) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
this.draging = false;
|
this.draging = false;
|
||||||
if (this.swiping) {
|
if (this.swiping) {
|
||||||
this.swipeLeaveTransition(this.offset > 0 ? -1 : 1);
|
this.swipeLeaveTransition(this.offset > 0 ? -1 : 1);
|
||||||
|
@ -63,6 +63,7 @@ export default {
|
|||||||
| left-width | 左侧滑动区域宽度 | `Number` | `0` |
|
| left-width | 左侧滑动区域宽度 | `Number` | `0` |
|
||||||
| right-width | 右侧滑动区域宽度 | `Number` | `0` |
|
| right-width | 右侧滑动区域宽度 | `Number` | `0` |
|
||||||
| on-close | 关闭时的回调函数 | `Function` | - |
|
| on-close | 关闭时的回调函数 | `Function` | - |
|
||||||
|
| disabled | 是否禁用滑动 | `Boolean` | `false` |
|
||||||
|
|
||||||
### Slot
|
### Slot
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user