Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 10 Next »

1. 使用变量

使用变量的格式:{{字段名}}  ,例如:

{{门店名称}}  
{{city}}  

 

访问Map对象格式: 变量名["字段名"] , 例如遍历dataRow时:

item["销售额"]

2. 变量的计算

可以直接使用计算符号,例如: 

//直接计算字段变量
{{ 销售额/10000 }} 万元
{{ ( (销售额-去年销售额) / 去年销售额 ) * 100 }}

//遍历dataRow时,计算字段列,必须对字段使用括号
{{ ( ( (item["销售额"])-(item["去年销售额"])) / (item["去年销售额"]) ) * 100 }}

 

3. 控制语句

if ... else
{% if (销售额 > 300) %}
<div>销售额大于300了!</div>
{% elseif (销售额 > 100) %}
<div>销售额在100与300之间!</div> 
{% else %}
<div>销售额不足100!</div> 
{% endif %}
for循环
<table style="border-color: #cfcfcf;" border="1" width="453" cellspacing="0">
<tr style="height: 28.05px; background-color: #2d8ac7;color:#fff;font-weight:bold;">
<td style="width: 70.1167px; height: 12px;">序号</td>
<td style="width: 70.1167px; height: 12px;">日期</td>
<td style="width: 188.883px; height: 12px;">门店名称</td>
<td style="width: 70.1167px; height: 12px;">款名</td>
<td style="width: 97px; height: 12px;">金额</td>
</tr>
{% for item in dataRow %}
<tr style="height: 12px;">
<td style="width: 70.1167px; height: 12px;">{{loop.index}}</td>
<td style="width: 70.1167px; height: 12px;">{{item["日期"]}}</td>
<td style="width: 188.883px; height: 12px;">{{item["门店名称"]}}</td>
<td style="width: 70.1167px; height: 12px;">{{item["款名"]}}</td>
<td style="width: 97px; height: 12px;">{{item["金额"]}}</td>
</tr>
{% endfor %}
</table>

 

4. 内置函数

 

函数描述示例
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   

 

 

 

 

  • No labels