0

How to add the first three elements of a for loop in sightly and show the value as Total. I have code as below

{{each(i, provision) provisionTypes}}
    <label class="day-provision-label">
        <input type="checkbox" class="day-provision" data-provision-type="${provision}" {{if day[provision]}}checked{{/if}} {{if !day.working}}disabled{{/if}}>
        ${provision.charAt(0).toUpperCase() + provision.slice(1)}
        <span class="provision-rate ui-supporting-text">
            $${rates[provision].toFixed(5)}
        </span>
    </label>
{{/each}}

What I want to do is that in the each for loop, I want to display to the total of the first three elements... Not sure how to?

4

1 回答 1

5

我认为这在 Sightly 中是不可能的。它仅用于演示目的。它甚至没有算术运算,所以你不能用它来加数字。您必须在后端执行此操作。您可以使用 WCMUse API(以javajavascript形式)向您的组件添加一些逻辑

于 2015-05-21T13:33:08.483 回答