分享web开发知识

注册/登录|最近发布|今日推荐

主页 IT知识网页技术软件开发前端开发代码编程运营维护技术分享教程案例
当前位置:首页 > 软件开发

dot.js的使用

发布时间:2023-09-06 01:40责任编辑:郭大石关键词: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>

dot.js的使用

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

知识推荐

我的编程学习网——分享web前端后端开发技术知识。 垃圾信息处理邮箱 tousu563@163.com 网站地图
icp备案号 闽ICP备2023006418号-8 不良信息举报平台 互联网安全管理备案 Copyright 2023 www.wodecom.cn All Rights Reserved