Toggle navigation
Toggle navigation
This project
Loading...
Sign in
monitor_v3
/
hg-monitor-web
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
0
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
wangtao
3 years ago
Commit
1b2956f02fd7d452a2c1a03f077fbb1708c9a505
1 parent
5b572c10
表格组件,超过2行展示tooltip
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
4 deletions
hg-monitor-web-base/src/main/resources/static/vue3/src/components/common/table-page/index.html
hg-monitor-web-base/src/main/resources/static/vue3/src/components/common/table-page/index.js
hg-monitor-web-base/src/main/resources/static/vue3/src/components/common/table-page/index.html
View file @
1b2956f
...
...
@@ -30,12 +30,12 @@
</div>
<span
v-else
>
<el-tooltip
placement=
"top"
>
<template
#
content
>
<el-tooltip
placement=
"top"
:disabled=
"scope.row.isShowTooltip == undefined || scope.row.isShowTooltip == false"
>
<template
#
content
>
<div
v-html=
"getTextContent(scope.row[item.prop])"
>
</div>
</template>
<div
style=
"overflow: hidden; text-overflow: ellipsis;display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
"
>
<div
class=
"text-overflow-line2"
@
mouseenter=
"tableColMouseenter($event,scope.row)
"
>
{{scope.row[item.prop]}}
</div>
</el-tooltip>
...
...
hg-monitor-web-base/src/main/resources/static/vue3/src/components/common/table-page/index.js
View file @
1b2956f
...
...
@@ -277,6 +277,26 @@ export default {
emit
(
'handleSelectAll'
,
selection
)
}
/**
* 表格组件,超过2行展示tooltip
* @param e
* @param item
*/
const
tableColMouseenter
=
(
e
,
item
)
=>
{
const
ev
=
e
.
target
;
var
height
=
$
(
ev
).
scroll
().
height
()
console
.
log
(
height
);
// 超过2行
if
(
height
>
45
)
{
// 实际高度 > 可视高度 文字溢出
item
.
isShowTooltip
=
true
;
}
else
{
// 否则为不溢出
item
.
isShowTooltip
=
false
;
}
}
// 挂载完
Vue
.
onMounted
(()
=>
{
//callback();
...
...
@@ -305,7 +325,8 @@ export default {
prePage
,
nextPage
,
getWidth
,
getTextContent
getTextContent
,
tableColMouseenter
}
}
}
...
...
Please
register
or
login
to post a comment