zoukankan      html  css  js  c++  java
  • dot.js的使用

    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>
  • 相关阅读:
    fenby C语言 P9
    fenby C语言 p7
    fenby C语言 P6
    fenby C语言
    让博客园博客自动生成章节目录索引
    python学习之路:生成器并行运算
    Python学习之路:生成器
    Python学习之路:装饰器实现终极版
    Python学习之路:装饰器实现2
    Python学习之路:装饰器实现
  • 原文地址:https://www.cnblogs.com/super-chao/p/8392361.html
Copyright © 2011-2022 走看看