docs(ContactCard): use composition api

This commit is contained in:
chenjiahan
2020-12-15 14:48:19 +08:00
parent 43a7047326
commit 25634382f6
3 changed files with 66 additions and 53 deletions
+14 -11
View File
@@ -42,21 +42,24 @@ export default {
```
```js
import { reactive } from 'vue';
import { Toast } from 'vant';
export default {
data() {
return {
currentContact: {
name: 'John Snow',
tel: '13000000000',
},
};
},
methods: {
onEdit() {
setup() {
const currentContact = reactive({
name: 'John Snow',
tel: '13000000000',
});
const onEdit = () => {
Toast('edit');
},
};
return {
onEdit,
currentContact,
};
},
};
```