vue 實現超長文本截取,懸浮框提示
更新時間:2020年07月29日 09:33:28 作者:buzdaaa
這篇文章主要介紹了vue 實現超長文本截取,懸浮框提示,具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧
vue 超長文本截取,懸浮框提示
樣式:
<style> .overflow-table .ivu-table-cell{ overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } </style>
table:
<Table border :columns="comDataColunms" :data="comDataList" :loading="tableDataLoading" class="overflow-table table-context"></Table>
主要代碼:
{ title: '統一信用代碼', key: 'ucCode', render: (h, params) => { return h('span', { domProps: { title: params.row.ucCode } }, params.row.ucCode) } }
補充知識:前端使用ElementUI +Vue table表頭添加tooltip懸浮提示框
廢話不多說,看代碼~
<el-table empty-text=“正在加載中…” :data=“contentList” style=“width: 100%” @sort-change=“sort” class=“pro-table-item” tooltip-effect=“dark”
<template v-for="(item,index) in titleList"> <el-table-column v-if="index == '0'" :prop="index.toString()" :label="item" sortable="custom" min-width="120" :render-header="renderHeader" > </el-table-column> <el-table-column v-else :prop="index.toString()" :label="item" min-width="120" :render-header="renderHeader" show-overflow-tooltip
renderHeader(h, { column }) { if(column.label.length>13) { return ( {column.label} ) } else { return ( {column.label} ) } },
并不想讓所有的表頭都彈出tooltip,只想讓超出長度并且
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
以上這篇vue 實現超長文本截取,懸浮框提示就是小編分享給大家的全部內容了,希望能給大家一個參考,也希望大家多多支持腳本之家。