码迷,mamicode.com
首页 > Web开发 > 详细

doT js模板入门 3

时间:2018-03-03 18:19:47      阅读:198      评论:0      收藏:0      [点我收藏+]

标签:for   时长   时间   class   nbsp   估计   period   policy   amp   

for 循环前推断循环的list是否为空

<script id="invoiceListDot" type="text/x-dot-template">
                {{?

it.invoiceInfoDtos}} {{ for(var prop=0;prop <it.invoiceInfoDtos.length ; prop++){ }} <div class="{{ if(prop==0){}}invoice-infor {{ }else {}}no-invoice{{ }}}" data-index="{{= prop }}"> <span class="no-ivoice-icon"></span> <span>普通发票</span> <span class="ivo-margin">{{= it.invoiceInfoDtos[prop].content }}</span> <span class="ivo-margin">{{= it.invoiceInfoDtos[prop].title }}</span> <span class="ivo-margin">{{= it.invoiceInfoDtos[prop].address }}</span> <span class="ivo-margin">{{= it.invoiceInfoDtos[prop].receiver }}</span> <span class="ivo-margin">{{= it.invoiceInfoDtos[prop].phone }}</span> </div> {{ } }} {{?

}} </script>

if 推断

<li class="company-state">
                    {{? it.orgAppRelList[i].expire }}
                    {{=it.orgAppRelList[i].endDate }}已过期
                    {{?? }}
                    {{? it.orgAppRelList[i].isTrial }}
                    试用中的企业无法订购,<span class="warning">{{=it.orgAppRelList[i].endTime }}过期</span>
                    {{?? }}
                    {{? it.orgAppRelList[i].status==‘001‘ }} 未购买{{?

?

it.orgAppRelList[i].status==‘002‘}}已支付 {{?

? }}已购买&nbsp; {{=it.orgAppRelList[i].endDate }}过期 {{? }} {{?}} {{?

}} </li>

宏的使用

<div class="content" id="serviceItem">
            {{##def.spaceUnit:
            {{?

it.productPrice.policyInfo.storageUnit==1 }}K{{??

it.productPrice.policyInfo.storageUnit==2}}M{{?

? it.productPrice.policyInfo.storageUnit==3}}G {{?? }}T {{? }} #}} <div class="buy-list"> <ul> <li class="buy-name">购买时长:</li> <li class="buy-select"><p>{{=it.productPrice.userPeriod}}个月</p></li> <li class="buy-unit"></li> <li class="buy-state">估计到期时间:{{=it.productPrice.endTime}}</li> </ul> </div> <div class="buy-list"> <ul> <li class="buy-name">用户数:</li> <li class="buy-select"><input name="userCount" onkeypress="eventUtil.onlyNumberKeyPress(event)" type="text"></li> <li class="buy-unit"></li> <li class="buy-state">用户单位价格 {{=it.productPrice.normalPriceDto.userPeriodPrice}}元/人 {{?

it.productPrice.policyInfoDto.periodUnit==1 }}{{?? it.productPrice.policyInfoDto.periodUnit==2}}{{?? it.productPrice.policyInfoDto.periodUnit==3}}{{?? }}单位未知 {{?

}} <span class="warning">(眼下仅仅支持200人以内的团队)</span></li> </ul> </div> <div class="buy-list"> <ul> <li class="buy-name">扩容空间(全部):</li> <li class="buy-select"><input name="expansion_storage" onkeypress="eventUtil.onlyNumberKeyPress(event)" type="text"></li> <li class="buy-unit">{{#def.spaceUnit}}</li> <li class="buy-state">空间单位价格 {{=it.productPrice.normalPriceDto.storagePrice}}元/ {{#def.spaceUnit}} </li> </ul> </div> </div>

參考:
doT js 入门
作者:黄威(1287789687@qq.com)

doT js模板入门 3

标签:for   时长   时间   class   nbsp   估计   period   policy   amp   

原文地址:https://www.cnblogs.com/zhchoutai/p/8497190.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!