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
@@ -71,9 +71,11 @@ app.use(SwipeCell);
```
```js
import { Dialog } from 'vant';
export default {
methods: {
beforeClose({ position, instance }) {
setup() {
const beforeClose = ({ position }) => {
switch (position) {
case 'left':
case 'cell':
@@ -81,14 +83,14 @@ export default {
return true;
case 'right':
return new Promise((resolve) => {
this.$dialog
.confirm({
message: 'Are you sure to delete?',
})
.then(resolve);
Dialog.confirm({
title: 'Are you sure to delete?',
}).then(resolve);
});
}
},
};
return { beforeClose };
},
};
```