fastadmin 列表内容超出隐藏
formatter: function (value, row, index, field) {
let _value = value && 'null' != value ? value : '';
// 只做省略显示,不要 title!
return `<span class="record-ellipsis" style="display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">${_value}</span>`;
},
// 跟进记录悬浮提示(零延迟,用 layer.tips)
let tipIndex = null;
$(document).on('mouseenter', 'td:has(.record-ellipsis)', function (e) {
let text = $(this).find('.record-ellipsis').text();
if (!text) return;
// 鼠标一上来立刻显示(time:0 表示不自动关闭)
tipIndex = layer.tips(text, this, {
tips: [1, '#909399'], // 2=在下方,颜色深色
time: 0,
maxWidth: 400,
});
let topVal = $("#layui-layer" + tipIndex).offset().top;
$("#layui-layer" + tipIndex).css("top", (topVal + 5) + "px");
}).on('mouseleave', 'td:has(.record-ellipsis)', function () {
layer.close(tipIndex);
});