FreeMaker实现变量求和

    今天在项目上遇到统计分页页面的某个字段的总和,前台页面是使用FreeMaker实现的,记录一下:

<#assign tprice = 0 >
<#list  orderlist as order >
      <#if order.price??>
            <#assign tprice = tprice + order.price >
       </#if>
</#list>
${tprice }  <!#-- 输出结果 -->
原文地址:https://www.cnblogs.com/hezhh/p/5417253.html