1 實例一:
2 { field: 'status',
align: 'center',
title: '活動狀態',
templet: function (d) {
4 if (d.status == "1") {
5 return "<span class='btnNot' style='background: rgba(13,185,51,0.72); padding: 6px; border-radius: 3px; color: #ffffff;'>已發布</span>";
6 } else {
7 return "<span class='btnNot' style='background: rgba(0,0,0,0.37); padding: 6px; border-radius: 3px; color: #ffffff;'>未發布</span>";
8 }
9 }
10 }
//返回的是發布|未發布的狀態;
1 //帶有判斷條件的操作列模板
2 <!--操作-->
3 <script type="text/html" id="flinkbar">
4
5 {{# if(d.status != "END"){ }}
6 {{# if(d.suspended){ }}
7 <a class="layui-btn layui-btn-mini" lay-event="start-process">繼續</a>
8 {{# } else { }}
9 <a class="layui-btn layui-btn-mini" lay-event="stop-process">暫停</a>
10 {{# } }}
11 <a class="layui-btn layui-btn-mini layui-btn-danger-m" lay-event="del">中止</a>
12 {{# } }}
13 </script>