<template>
<div>
<!-- 联系人列表 -->
<van-contact-list
:list="list"
@add="onAdd"
@edit="onEdit"
/>
</div>
</template>
<script>
import {ContactList} from 'vant'
import axios from 'axios';
export default {
name: 'contactList',
components: {
[ContactList.name]: ContactList
},
data() {
return {
list: [],
instance: null //axios实例
}
},
create() {
this.instance = axios.create({
baseURL: 'http://localhost:9000/api',
timeout: 1000
})
this.instance.get('/contactList')
.then(res =>{
console.log(res)
// this.list = res.data.data
})
},
methods: {
//添加联系人
onAdd() {
},
//编辑联系人
onEdit() {
}
}
}
</script>
- -知道了 created少写了