template模版

<script id="trTemplate" type="text/x-jquery-tmpl">
  {%each(i) data%}
  	<tr>
    	<td>\${i+1}</td>
    	<td>
        	<button type="button" class="btn btn-primary btn-xs" containerId="\${recordId}">查看容器</button>
        	<button type="button" class="btn btn-success btn-xs" data-toggle="modal" data-target="#messageInfo" msgId="\${msgId}">报文详情</button>
    	</td>
    	<td>\${flightNo}</td>
    	<td>\${DateFormat(flightDate,'yyyy-MM-dd')}</td>
    	<td>\${tailNo}</td>
    	<td>\${DateFormat(flightTime,'yyyy-MM-dd hh:mm:ss')}</td>
    	<td>\${departAirport}</td>
    	<td>\${destAirport}</td>
    	<td>\${DateFormat(opTime,'yyyy-MM-dd hh:mm:ss')}</td>
    	<td>
			{%if recordStatus==0%}
				未出港
			{%/if%}
			{%if recordStatus==1%}
				已出港
			{%/if%}
		</td>
	</tr>
  {%/each%}
</script>
调用给指定元素添加html模版

$("#trTemplate").tmpl(returnObj).appendTo("#contentContainer");



Logo

权威|前沿|技术|干货|国内首个API全生命周期开发者社区

更多推荐