为了账号安全,请及时绑定邮箱和手机立即绑定

如何使用wix corvid将循环数据连接到pdfgeneratorapi?

如何使用wix corvid将循环数据连接到pdfgeneratorapi?

绝地无双 2023-01-06 10:42:25
我正在使用https://pdfgeneratorapi.com/生成 PDF 。现在我可以使用这段代码一个一个地显示数据。任何人都可以给我建议如何用循环或任何其他方式显示所有数据吗?下面的照片显示了我来自 pdfgenerator 的模板。这是我用来生成 PDF 的代码    let communicationWay1=[    {0:"dim"},    {1:"kal"}    ];    let cstomerExpence1=[    {0:"dim"},     {1:"kal"}    ];   let title="test";   let names="test";   let phone="test";   let email="test";let maritalStatus="test";let city="test";let other="test"; const result = await wixData.query(collection) .eq('main_user_email', $w('#mainE').text)         .find()    .then( (results) => { if (results.totalCount>0) {                    count=1; // title=results.items[1].title;                        names=results.items[0].names;                        email=results.items[0].emial;                        phone=results.items[0].phone;                        maritalStatus=results.items[0].maritalStatus;                        city=results.items[0].city;                        other=results.items[0].cousterExpenses_other;                                               title=results.items[0].title;                         communicationWay=results.items[0].communicationWay;                        cstomerExpence=results.items[0].cstomerExpence;                } if (results.totalCount>1) {                                      names1=results.items[1].names;                        email1=results.items[1].emial;                        phone1=results.items[1].phone;                        maritalStatus1=results.items[1].maritalStatus;                        city1=results.items[1].city;                        other1=results.items[1].cousterExpenses_other;                                              title1=results.items[1].title;                        communicationWay1=results.items[1].communicationWay;                        cstomerExpence1=results.items[1].cstomerExpence;                }     } )    .catch( (err) => {      console.log(err);    } );
查看完整描述

2 回答

?
阿波罗的战车

TA贡献1862条经验 获得超6个赞

只需将它放在带有布尔条件的 while 循环中即可。

您可以创建一个变量,例如allShowed,并将其值设置为False。之后,创建另一个变量,例如numberOfDataToShow,并将其设置为您要显示的元素数。然后创建一个计数器,countShowed,初始化0为它的值。

现在创建一个 while 循环:当allShowed值为时False,您循环(并添加数据)。每次显示一条数据时,您都会增加的值countShowed(并将其设置为继续添加/显示数据)。当countShowed将具有完全相同的值时numberOfDataToShow,设置allShowedTrue。循环将中断并显示所有数据。


查看完整回答
反对 回复 2023-01-06
?
繁星coding

TA贡献1797条经验 获得超4个赞

您需要使用 PDF Generator API 中的ContainerTable组件来迭代项目列表。正如@JustCallMeA 所说,您需要发送一系列项目。PDF 生成器 API 现在有一个带有演示页面的官方 Wix Velo(以前称为 Corvid)教程:https: //support.pdfgeneratorapi.com/en/article/how-to-integrate-with-wix-velo-13s8135


查看完整回答
反对 回复 2023-01-06
  • 2 回答
  • 0 关注
  • 132 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信