layui table中渲染html对象

 4 months ago
source link: https://blog.p2hp.com/archives/9657
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

layui table中渲染html对象

<script type="text/html" id="see-bar">
<a class="layui-btn layui-btn-primary layui-btn-xs " data-id="{{d.id}}" onclick="see(this)" lay-event="See" style="color:#2880cb">{{d.card_number}}</a>


, cols: [[

, { '13%', title: '卡片编号', align: 'center', rowspan: '1', toolbar: '#see-bar' }

, cols: [[
{ type: 'numbers', title: '序号', '15%' }

, {
title: '操作', '20%', align: 'center', rowspan: '1', templet: function (d) {
var html = '<a class="layui-btn layui-btn-primary layui-btn-xs " lay-event="edit" style="color:#2880cb">修改</a>';
if (d.state == 0)
html += '<a class="layui-btn layui-btn-primary layui-btn-xs" lay-event="disable" style="color:#2880cb">禁用</a>';
html += '<a class="layui-btn layui-btn-primary layui-btn-xs" lay-event="enable" style="color:#2880cb">启用</a>';
return html;

About Joyk

Aggregate valuable and interesting links.
Joyk means Joy of geeK