在Sendgrid Design模板中,如何对表使用车把迭代? [英] In Sendgrid Design template, how to use handlebar iteration for table?
问题描述
我正在使用带有模块代码"的SendGrid在线设计"模板.
I'm using SendGrid online "Design" template, with a module "code".
在其文档中( https://sendgrid.com/docs /ui/sending-email/editor/#code-modules ),他们说代码编辑器不会修改或验证任何HTML .
In their documentation (https://sendgrid.com/docs/ui/sending-email/editor/#code-modules), they say that de code editor does not modify or validate any HTML.
如果我在代码模块中编写这段代码:
If I write this piece of code inside the code module:
<ul>
{{#each items}}
<li>test</li>
{{/each}}
</ul>
<table>
<tbody>
{{#each items}}
<tr>
<td>Col 1</td>
<td>Col 2</td>
</tr>
{{/each}}
</tbody>
</table>
它导致:
<ul>
{{#each items}}
<li>test</li>
{{/each}}
</ul>
{{#each items}}{{/each}}
<table>
<tbody><tr>
<td>Col 1</td>
<td>Col 2</td>
</tr></tbody>
</table>
我们可以看到{{each}}
函数停留在ul
的正确位置,但已从table
内部删除.这是暂时的错误吗?我该怎么做这个简单的操作?
We can see that the {{each}}
function stays in the right place for the ul
, but is remove from inside of the table
. Is this a temporary bug? How can I do this simple operation?
感谢您的帮助
推荐答案
我找到了一种未公开的方法来使此工作有效.您需要像这样注释掉each
助手:
I found a undocumented way to make this works. You will need to comment out the each
helper like this:
<table>
<tbody>
<!-- {{#each items}} -->
<tr>
<td>Col 1</td>
<td>Col 2</td>
</tr>
<!-- {{/each}} -->
</tbody>
</table>
这篇关于在Sendgrid Design模板中,如何对表使用车把迭代?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!