iview tooltip: true, 处理文字,溢出用点代替

{
title: ‘老师标签’,
key: ‘tags’,
align: ‘center’,
minWidth: 100,
ellipsis: true,
tooltip: true,
render: (h, params) => {
// 处理文字,溢出用点代替
let txt;
if (params.row.tags) {
txt = params.row.tags.join(’,’);
}
let tableTxt = null;
if (txt) {
if (txt.length > 5) {
tableTxt = txt.substring(0, 5) + ‘…’;
} else {
tableTxt = txt;
}
}
let str = ‘-’;
if (params.row.tags) {
str = params.row.tags.join(’,’);
}
return (

{tableTxt}

);
}
}

上一篇:【swift】guard、if let


下一篇:elementUI表格点击行按钮传参