【发布时间】:2021-11-25 16:58:17
【问题描述】:
我使用了在这里找到的代码Building table dynamically with PDFMake,它可以完美地处理来自 API 的动态数据。但我的问题是嵌套 JSON。
这是 JSON 的样子:
dataseries":[
{
"timepoint":3,
"cloudcover":2,
"seeing":6,
"transparency":2,
"lifted_index":10,
"rh2m":2,
"wind10m":{
"direction":"N",
"speed":2
},
"temp2m":23,
"prec_type":"none"
},
{
"timepoint":6,
"cloudcover":2,
"seeing":6,
"transparency":2,
"lifted_index":15,
"rh2m":3,
"wind10m":{
"direction":"N",
"speed":2
},
"temp2m":21,
"prec_type":"none"
},
我正在尝试生成 wind10m 的内容,特别是 PDF 文件上的 direction 和 speed。如何访问和生成两个不同的 direction 和 speed 列?
这是我的 stackblitz 演示:https://stackblitz.com/edit/angular-ojgxtj?file=src%2Fapp%2Fapp.component.ts
【问题讨论】:
-
我看到了你的 cmets,我更新了我的答案。如果这解决了你的问题,请点赞。谢谢
标签: angular typescript pdfmake