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>
  • 相关阅读:
    算法导论:堆排序
    地域划分
    字符串翻转
    lintcode:买卖股票的最佳时机 IV
    lintcode:买卖股票的最佳时机 III
    lintcode:买卖股票的最佳时机 II
    lintcode:买卖股票的最佳时机 I
    2016腾讯编程题:微信红包
    2016腾讯编程题:生成格雷码
    2016京东编程题:小东分苹果
  • 原文地址:https://www.cnblogs.com/super-chao/p/8392361.html
Copyright © 2011-2022 走看看