javascript - 使用全日历“事件作为函数”(在 Vue 中)并返回一个承诺在更新资源时不会填充事件?
问题描述
我正在通过设置根据更改的选择元素更新资源列表,this.calendarOptions.resources
并且我还使用函数来获取事件。
当我将这些东西结合起来时,资源会显示出来,并且似乎会获取事件,但它们不会显示在时间轴中。我也在calendarAPI.refetchEvents()
更新资源后尝试过,看看是否有什么不同。事件已获取,但仍不显示。
如果我修复资源而不更新它,日历事件将成功显示。
任何可能发生这种情况的想法都非常感谢。
calendarOptions: {
resources: [],
events: this.getEvents
...
}
获取事件:
async getEvents(info) {
try {
const response = await this.$http.get(myurl)
return response.data.bookings
} catch (e) {
console.log(e)
}
}
获取资源:
async getResources() {
try {
const response = await this.$http.get(myresourceurl)
this.calendarOptions.resources = response.data.resources
} catch (e) {
console.log(e)
}
}
111
解决方案
道歉。原来资源的 API 返回的是“resourceId”而不是“id”
推荐阅读
- gnuplot - 在 GNUplot 中一起绘制 2D 热图和普通 2D 图
- excel - 将计算字段添加到 Excel 图表
- c++ - 我是否需要在 std::function 上使用 unique_ptr
- azure - 如何将 Get-AzIntegrationAccountMap 的值存储在变量中
- sql-server - 谷歌云 SQL 服务器对我通过云外壳自己创建的数据库没有权限
- json - MongoDB - 在集合中插入文档,但它具有来自其他集合的元素
- reactjs - for循环获取api调用并将响应存储在状态数组reactjs中
- flutter - Flutter:根据文档是否存在于 Cloud Firestore 中更新图标小部件
- python - 从具有元组值的字典中选择特定元素
- multithreading - Blazor WASM 阻止任务直到用户输入