docs(SwipeCell): use composition api
This commit is contained in:
@@ -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 };
|
||||
},
|
||||
};
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user