feat(SwipeCell): add before-close prop (#5320)

This commit is contained in:
neverland
2019-12-19 21:02:46 +08:00
committed by GitHub
parent 228b35af9b
commit ac00d78a46
5 changed files with 81 additions and 33 deletions
+10 -1
View File
@@ -17,7 +17,10 @@ export default createComponent({
],
props: {
// @deprecated
// should be removed in next major version, use beforeClose instead
onClose: Function,
beforeClose: Function,
disabled: Boolean,
leftWidth: Number,
rightWidth: Number,
@@ -158,7 +161,13 @@ export default createComponent({
this.$emit('click', position);
if (this.opened && !this.lockClick) {
if (this.onClose) {
if (this.beforeClose) {
this.beforeClose({
position,
name: this.name,
instance: this
});
} else if (this.onClose) {
this.onClose(position, this, { name: this.name });
} else {
this.swipeMove(0);