Merge branch 'master' of http://192.168.1.136:82/monitor_v3/hg-monitor-web into …
…master-v32-lushangqing
Showing
2 changed files
with
25 additions
and
4 deletions
@@ -30,12 +30,12 @@ | @@ -30,12 +30,12 @@ | ||
30 | </div> | 30 | </div> |
31 | 31 | ||
32 | <span v-else> | 32 | <span v-else> |
33 | - <el-tooltip placement="top"> | ||
34 | - <template #content> | 33 | + <el-tooltip placement="top" :disabled="scope.row.isShowTooltip == undefined || scope.row.isShowTooltip == false"> |
34 | + <template #content > | ||
35 | <div v-html="getTextContent(scope.row[item.prop])"> | 35 | <div v-html="getTextContent(scope.row[item.prop])"> |
36 | </div> | 36 | </div> |
37 | </template> | 37 | </template> |
38 | - <div style="overflow: hidden; text-overflow: ellipsis;display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;"> | 38 | + <div class="text-overflow-line2" @mouseenter="tableColMouseenter($event,scope.row)"> |
39 | {{scope.row[item.prop]}} | 39 | {{scope.row[item.prop]}} |
40 | </div> | 40 | </div> |
41 | </el-tooltip> | 41 | </el-tooltip> |
@@ -277,6 +277,26 @@ export default { | @@ -277,6 +277,26 @@ export default { | ||
277 | 277 | ||
278 | emit('handleSelectAll',selection) | 278 | emit('handleSelectAll',selection) |
279 | } | 279 | } |
280 | + | ||
281 | + /** | ||
282 | + * 表格组件,超过2行展示tooltip | ||
283 | + * @param e | ||
284 | + * @param item | ||
285 | + */ | ||
286 | + const tableColMouseenter = (e, item) => { | ||
287 | + const ev = e.target; | ||
288 | + var height = $(ev).scroll().height() | ||
289 | + console.log(height); | ||
290 | + // 超过2行 | ||
291 | + if (height > 45) { | ||
292 | + // 实际高度 > 可视高度 文字溢出 | ||
293 | + item.isShowTooltip = true; | ||
294 | + } else { | ||
295 | + // 否则为不溢出 | ||
296 | + item.isShowTooltip = false; | ||
297 | + } | ||
298 | + } | ||
299 | + | ||
280 | // 挂载完 | 300 | // 挂载完 |
281 | Vue.onMounted(() => { | 301 | Vue.onMounted(() => { |
282 | //callback(); | 302 | //callback(); |
@@ -305,7 +325,8 @@ export default { | @@ -305,7 +325,8 @@ export default { | ||
305 | prePage, | 325 | prePage, |
306 | nextPage, | 326 | nextPage, |
307 | getWidth, | 327 | getWidth, |
308 | - getTextContent | 328 | + getTextContent, |
329 | + tableColMouseenter | ||
309 | } | 330 | } |
310 | } | 331 | } |
311 | } | 332 | } |
-
Please register or login to post a comment