// Angular (ng-alain)
columns: STColumn[] = [
{ title: '备注说明', index: 'remark', render: 'remark' },
}
<ng-template st-row="remark" let-item let-index="index">
<div class="text-overflow" [title]="item?.remark">{{item?.remark}}</div>
</ng-template>
.text-overflow{
width:130px; /* 超过宽度就显示... */
text-overflow: ellipsis; /* 显示... */
overflow: hidden; /* 隐藏文字 */
white-space: nowrap; /* 不换行 */
cursor: pointer; /* hover显示手形 */
}
// Vue (iview)
dataCol:[
{
title: '预警类型',
key: 'warning_setting_type',
align: 'center',
render: (h, params) => {
var text=params.row.warning_setting_type;
return h('div',{
style:{
overflow:'hidden',
whiteSpace: 'nowrap',
textOverflow:'ellipsis'
},
attrs: {
title:text
}
},text)
}
}
]