首页 > Web开发 > 详细

dot.js的使用

时间:2018-01-31 15:23:45      阅读:273      评论:0      收藏:0      [点我收藏+]

dot.js使用:

1.数据显示:

var tmpl = doT.template($("#insuredViewListTemp")[0].text);
var tmplEidt = doT.template($("#insuredEditListTemp")[0].text);
$("#insuredViewList").html(tmpl(data));
$("#insuredEditList").html(tmplEidt(data));

说明:insuredViewList:容器id;insuredViewListTemp是js模板id。

列表循环遍历:

type="text/x-dot-template"

<script type="template" id="beneficiaryViewListTemp">
        {{ for(var prop in it) { }}
        <ul class="ulList_common ulList_commonView1 favoreeDetail">
            <li class="personName"><span>{{=replaceNull(it[prop].name)}}</span><img
                    src="../img/male.png"/></li>
            <li>
                <label>与被保险人关系:</label><span>{{=replaceNull(it[prop].relation)}}</span>
                <em>|</em>
                <label>证件号码:</label><span>{{=replaceNull(it[prop].identityNo)}}</span>
                <em>|</em>
                <label>受益比例:</label><span>{{=replaceNull(it[prop].benefitProportion)}}<em>%</em></span>
            </li>
        </ul>
        {{ } }}
</script>

===================================

2.if else判断:

{{? it.sex === 0}}
<img src="../img/female.png"/>
{{?? it.sex === 1}}
<img src="../img/male.png"/>
{{?}}

 

<p>
<label class="info-a">状态:</label>
<label class="info-b">
    {{? it[intentionKey].status===0 }}未审核
    {{?? it[intentionKey].status===1 }}审核通过
    {{?? it[intentionKey].status===2 }}意向撤销
    {{?? it[intentionKey].status===3 }}转预约
    {{?? it[intentionKey].status===4 }}转预约撤销
    {{?? }}无此状态
    {{? }}
</label>
</p>

 

dot.js的使用

原文:https://www.cnblogs.com/super-chao/p/8392361.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!