<table class="layui-hide" id="taolist" lay-filter="table-taolist"></table>

<script type="text/html" id="table-taolist">
<a class="layui-btn layui-btn-warm layui-btn-xs" lay-event="ticket"><i class="layui-icon layui-icon-cart-simple"></i>领券</a>
</script>


<script>
    layui.use(function() {
    var layer = layui.layer,
    table = layui.table,
    element = layui.element;

    table.render({
        elem: '#taolist',
    url: 'https://a.zkxblog.com:8083/list',
    cols: [
    [{
        field: 'quanhou',
    title: '卷后¥',
    width: 90,
    style:"color:red",
    sort: true
                        }, {
        field: 'tao_title',
    title: '商品名称',
                        },{title: '领券下单', width: 90, align: 'center', fixed: 'right', toolbar: '#table-taolist'}]
    ]
                });

    table.on('tool(table-taolist)', function(obj){
    var data = obj.data;
    if(obj.event === 'ticket'){
        window.open(data.shorturl)
    } 
  });

            });
</script>
Last modification:April 12, 2022
如果觉得我的文章对你有用,请随意赞赏