问题描述
我的 api 有以下数据:
[
{
"id": 1,"start": "2020-12-24 01:00","end": "2020-12-24 01:30","comments": null,"createdAt": "2020-12-24T19:37:52.699Z","updatedAt": "2020-12-24T19:37:52.699Z","clientId": 1,"employeeId": null,"serviceId": null,"appointmentStatusId": null,"tenantId": 1,"employee": null,"client": {
"firstName": "Tamires","lastName": "Almeida"
}
},{
"id": 3,"start": "2020-12-24 21:15","end": "2020-12-24 22:00","createdAt": "2020-12-24T19:45:03.854Z","updatedAt": "2020-12-24T19:45:03.854Z","employeeId": 1,"employee": {
"firstName": "Aline","lastName": "Magalhães"
},{
"id": 2,"end": "2020-12-24 02:00","createdAt": "2020-12-24T19:39:19.184Z","updatedAt": "2020-12-24T19:39:19.184Z",{
"id": 13,"start": "2020-12-25 06:00","end": "2020-12-25 07:00","comments": "Fuck you","createdAt": "2020-12-25T16:24:10.893Z","updatedAt": "2020-12-25T16:24:10.893Z","employeeId": 2,"serviceId": 1,"employee": {
"firstName": "Margareth","lastName": "Martins"
},{
"id": 14,"start": "2020-12-25 01:00","end": "2020-12-25 06:00","createdAt": "2020-12-25T22:08:40.878Z","updatedAt": "2020-12-25T22:08:40.878Z",{
"id": 15,"start": "2020-12-26 08:30","end": "2020-12-26 09:00","createdAt": "2020-12-25T22:52:31.439Z","updatedAt": "2020-12-25T22:52:31.439Z",{
"id": 10,"start": "2020-12-23 09:00","end": "2020-12-23 09:30","comments": "é fodauuuuuuu","createdAt": "2020-12-25T15:12:20.790Z","updatedAt": "2020-12-25T15:12:20.790Z",{
"id": 11,"end": "2020-12-23 12:00","createdAt": "2020-12-25T15:12:44.161Z","updatedAt": "2020-12-25T15:12:44.161Z",{
"id": 4,"end": "2020-12-25 05:00","createdAt": "2020-12-25T02:32:32.574Z","updatedAt": "2020-12-25T02:32:32.574Z",{
"id": 5,"end": "2020-12-24 03:00","comments": "ghhhhhh","createdAt": "2020-12-25T02:36:52.243Z","updatedAt": "2020-12-25T02:36:52.243Z",{
"id": 6,"start": "2020-12-25 01:15","end": "2020-12-25 02:00","createdAt": "2020-12-25T02:38:22.711Z","updatedAt": "2020-12-25T02:38:22.711Z",{
"id": 7,"start": "2020-12-25 00:15","end": "2020-12-25 03:00","comments": "treeeeee","createdAt": "2020-12-25T14:54:51.766Z","updatedAt": "2020-12-25T14:54:51.766Z",{
"id": 8,"start": "2020-12-25 04:00","createdAt": "2020-12-25T15:02:54.737Z","updatedAt": "2020-12-25T15:02:54.737Z",{
"id": 12,"start": "2020-12-31 19:30","end": "2020-12-31 21:00","comments": "Agora foi","createdAt": "2020-12-25T15:25:40.233Z","updatedAt": "2020-12-25T15:25:40.233Z","lastName": "Almeida"
}
}
]
我只需要在 V-Calendar vuetify 中显示其中的一些数据,根据其文档,例如:
{
name: 'name'
start: '0000-00-00 00:00'
end: '0000-00-00 00:00'
}
为了达到这个结构,我在我的 .Vue 中有以下代码片段:
created () {
this.initialize()
},methods: {
initialize () {
// request Events
axios.get('http://192.168.15.11:3000/events')
.then((response) => {
this.events = response.data
for (const item of this.events) {
const name = item.client.firstName + ' ' + item.client.lastName
const start = item.start
const end = item.end
const items = { name,start,end }
this.events = this.items
console.log(items);
}
})
.catch((error) => {
console.log(error.response);
})
},
我的控制台以我需要的正确格式提供此反馈,但在日历中没有事件:
V-Calendar 摘录:
<v-calendar
ref="calendar"
v-model="focus"
color="primary"
locale="pt-br"
:events="events"
:event-color="getEventColor"
:type="type"
@click:event="showEvent"
@click:more="viewDay"
@click:date="viewDay"
>
</v-calendar>
data: () => ({
events []
}),
我哪里错了,有人可以帮帮我吗?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)