我已经创建了一个表,在tbody里面有一个列表。它将生成一些行。但是,我必须使 resource name
每一行都是独一无二的。有什么想法吗?
<table>
<thead>
<tr>
<td></td>
</tr>
</thead>
<tbody data-sly-list="${itemCount}">
<tr>
<td>
<div data-sly-resource="${'resourceName' @ resourceType='components/content/mycomponent'}"></div>
</td>
</tr>
</tbody>
</table>
我不知道你打算怎么做。似乎你想生成唯一的合成资源名。
为此,你可以使用 itemList.count
或 itemList.index
的值,如。res1
, res2
...或 res0
, res1
... 查看 HTL规范中的细节.
你可能必须使用 data-sly-set
将数字与文本连接起来。
<tbody data-sly-list="${itemCount}">
<tr>
<td data-sly-set.resourceName="res${itemList.count}">
<div data-sly-resource="${resourceName @ resourceType='components/content/mycomponent'}"></div>
</td>
</tr>
</tbody>