layUI table操作列中tips使用

layUI table操作列中tips使用

有时候table表格渲染时,对于操作列的按钮特别长时,需要提示信息tips。

第一步:

table.render({
    cols: [[ //表头
         {fixed: 'right',title: '操作', width:200, align:'center', toolbar: '#operation'} //这里的toolbar值是模板元素的选择器
     ]],
)}

第二步:

<%-- 表格操作列模板 --%>
<script type="text/html" id="operation">
	<%-- data-d  自定义属性用于在tips中显示想要的内容--%>
    <a class="layui-btn layui-btn-xs" data-d="" onmouseover="showProStatus(this)" lay-event="proStatus">查看</a>
</script>

第三步:

<%-- 函数 --%>
<script type="text/html" id="operation">
	// 操作列tips
    function showProStatus(t) {
        // var row = $(t).attr('data-d'); // 获取显示内容 若需要,把tips第一个属性替换为row
        layer.tips('查看项目情况',t,{
			tips:1,           // 在标签上面显示tips
			time:1000     // 1秒消失
		})
    }
</script>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值