docs(SwipeCell): use composition api

This commit is contained in:
chenjiahan
2020-12-13 13:05:52 +08:00
parent d1f637afc7
commit 75f8e36923
3 changed files with 60 additions and 54 deletions
+10 -8
View File
@@ -81,10 +81,12 @@ app.use(SwipeCell);
```
```js
import { Dialog } from 'vant';
export default {
methods: {
setup() {
// position 为关闭时点击的位置
beforeClose({ position }) {
const beforeClose = ({ position }) => {
switch (position) {
case 'left':
case 'cell':
@@ -92,14 +94,14 @@ export default {
return true;
case 'right':
return new Promise((resolve) => {
this.$dialog
.confirm({
message: '确定删除吗?',
})
.then(resolve);
Dialog.confirm({
title: '确定删除吗?',
}).then(resolve);
});
}
},
};
return { beforeClose };
},
};
```