From 4320861c76946a6eb00d301fc6cd1b85a5b759c7 Mon Sep 17 00:00:00 2001 From: liuyiliang Date: Fri, 26 Jul 2024 14:00:20 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=87=E5=AD=97=E8=B6=85=E9=95=BF=E9=BC=A0?= =?UTF-8?q?=E6=A0=87=E7=A7=BB=E5=8A=A8=E5=87=BA=E7=8E=B0=E6=B5=AE=E7=AA=97?= =?UTF-8?q?=E3=80=81=E5=B7=A5=E5=8D=95bug=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main.js | 35 +++++++++++++++++++++++++++++ src/styles/element-ui.scss | 13 +++++++++++ src/views/smart/workorder.vue | 29 +++++++++++++++--------- src/views/smart/workorderDetail.vue | 10 +++++---- 4 files changed, 72 insertions(+), 15 deletions(-) diff --git a/src/main.js b/src/main.js index dec34a4..719666a 100644 --- a/src/main.js +++ b/src/main.js @@ -54,4 +54,39 @@ let vue = new Vue({ render: h => h(App) }).$mount('#app') + +// const style = document.createElement('style'); +// style.type = 'text/css'; +// style.innerHTML = ` +// .el-tooltip__popper { +// max-width: 300px; +// word-wrap: break-word; +// color: white; +// background: #00000069; +// } +// `; +// document.head.appendChild(style); + +document.addEventListener('mouseover', function(event) { + const target = event.target; + if (target && target.classList.contains('cell')) { + if (target.scrollWidth > target.clientWidth) { + const tooltip = document.createElement('div'); + tooltip.className = 'el-tooltip__popper'; + tooltip.style.position = 'absolute'; + tooltip.style.zIndex = 9999; + tooltip.innerText = target.innerText; + + document.body.appendChild(tooltip); + + const rect = target.getBoundingClientRect(); + tooltip.style.top = `${rect.top - tooltip.offsetHeight}px`; + tooltip.style.left = `${rect.left + (rect.width - tooltip.offsetWidth) / 2}px`; + + target.addEventListener('mouseleave', function() { + document.body.removeChild(tooltip); + }, { once: true }); + } + } +}); export default vue; diff --git a/src/styles/element-ui.scss b/src/styles/element-ui.scss index 26bd24c..cdb98b8 100644 --- a/src/styles/element-ui.scss +++ b/src/styles/element-ui.scss @@ -95,3 +95,16 @@ table { overflow: hidden; text-overflow: ellipsis; } +.el-tooltip__popper { + max-width: 300px; + word-wrap: break-word; + color: white; + background: #00000069; +} + +.el-tooltip__popper { + max-width: 350px; + word-wrap: break-word; + color: white; + background: rgba(0, 0, 0, 0.69); +} diff --git a/src/views/smart/workorder.vue b/src/views/smart/workorder.vue index 2155244..5bd0291 100644 --- a/src/views/smart/workorder.vue +++ b/src/views/smart/workorder.vue @@ -26,16 +26,16 @@ - - + + + + + + + + + +