breaking change(SwipeCell): adjust before-close usage
This commit is contained in:
@@ -80,21 +80,20 @@ app.use(SwipeCell);
|
||||
export default {
|
||||
methods: {
|
||||
// position 为关闭时点击的位置
|
||||
// instance 为对应的 SwipeCell 实例
|
||||
beforeClose({ position, instance }) {
|
||||
beforeClose({ position }) {
|
||||
switch (position) {
|
||||
case 'left':
|
||||
case 'cell':
|
||||
case 'outside':
|
||||
instance.close();
|
||||
break;
|
||||
return true;
|
||||
case 'right':
|
||||
Dialog.confirm({
|
||||
message: '确定删除吗?',
|
||||
}).then(() => {
|
||||
instance.close();
|
||||
return new Promise((resolve) => {
|
||||
this.$dialog
|
||||
.confirm({
|
||||
message: '确定删除吗?',
|
||||
})
|
||||
.then(resolve);
|
||||
});
|
||||
break;
|
||||
}
|
||||
},
|
||||
},
|
||||
@@ -110,7 +109,7 @@ export default {
|
||||
| name | 标识符,可以在事件参数中获取到 | _number \| string_ | - |
|
||||
| left-width | 指定左侧滑动区域宽度,单位为`px` | _number \| string_ | `auto` |
|
||||
| right-width | 指定右侧滑动区域宽度,单位为`px` | _number \| string_ | `auto` |
|
||||
| before-close `v2.3.0` | 关闭前的回调函数 | _Function_ | - |
|
||||
| before-close | 关闭前的回调函数,返回 `false` 可阻止关闭,支持返回 Promise | _(args) => boolean \| Promise_ | - |
|
||||
| disabled | 是否禁用滑动 | _boolean_ | `false` |
|
||||
| stop-propagation | 是否阻止滑动事件冒泡 | _boolean_ | `false` |
|
||||
|
||||
@@ -134,11 +133,10 @@ export default {
|
||||
|
||||
beforeClose 的第一个参数为对象,对象中包含以下属性:
|
||||
|
||||
| 参数名 | 说明 | 类型 |
|
||||
| -------- | -------------------------------------------------- | ----------- |
|
||||
| name | 标识符 | _string_ |
|
||||
| position | 关闭时的点击位置 (`left` `right` `cell` `outside`) | _string_ |
|
||||
| instance | SwipeCell 实例,用于调用实例方法 | _SwipeCell_ |
|
||||
| 参数名 | 说明 | 类型 |
|
||||
| -------- | -------------------------------------------------- | -------- |
|
||||
| name | 标识符 | _string_ |
|
||||
| position | 关闭时的点击位置 (`left` `right` `cell` `outside`) | _string_ |
|
||||
|
||||
### 方法
|
||||
|
||||
|
||||
Reference in New Issue
Block a user