[improvement]SwipeCell: add disabled prop (#1884)

This commit is contained in:
neverland 2018-10-02 17:01:29 +08:00 committed by GitHub
parent 93d8c809f9
commit a6d4d2d74a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 0 deletions

View File

@ -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

View File

@ -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);

View File

@ -63,6 +63,7 @@ export default {
| left-width | 左侧滑动区域宽度 | `Number` | `0` |
| right-width | 右侧滑动区域宽度 | `Number` | `0` |
| on-close | 关闭时的回调函数 | `Function` | - |
| disabled | 是否禁用滑动 | `Boolean` | `false` |
### Slot