【问题标题】:How to loop from certain number to certain number in AEM?如何在 AEM 中从某个数字循环到某个数字?
【发布时间】:2015-10-28 14:14:57
【问题描述】:

在 data-sly-list 中,我可以循环遍历元素,如下例所示

data-sly-list:为提供的对象中的每个可枚举属性重复宿主元素的内容。但是,如果我想循环遍历前 4 个元素或从第 8 到第 10 个元素,该怎么做呢?

这是一个简单的循环:

<dl data-sly-list="${currentPage.listChildren}">
    <dt>index: ${itemList.index}</dt>
    <dd>value: ${item.title}</dd>
</dl>

【问题讨论】:

    标签: aem


    【解决方案1】:

    使用这样的东西:

    <dl data-sly-list="${currentPage.listChildren}">
        <div data-sly-test="${itemList.count > 4 && itemList.count <8}" data-sly-unwrap>
            <dt>index: ${itemList.index}</dt>
            <dd>value: ${item.title}</dd>
        </div>
    </dl>
    

    您可以使用 countindex 变量。

    【讨论】:

      猜你喜欢
      • 2013-11-15
      • 1970-01-01
      • 1970-01-01
      • 2021-12-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-03-06
      • 1970-01-01
      相关资源
      最近更新 更多