Skip to content

Commit

Permalink
fixed: Remove Unused Style
Browse files Browse the repository at this point in the history
  • Loading branch information
ZhaoJiSen committed Dec 19, 2024
1 parent fba83f3 commit 98aa11b
Showing 1 changed file with 1 addition and 60 deletions.
61 changes: 1 addition & 60 deletions src/layout/components/NavLeft/Item.vue
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,6 @@ export default {
display: 'inline-block'
}
const tooltipStyle = {
position: 'fixed',
backgroundColor: 'rgba(0, 0, 0, 0.8)',
color: '#fff',
padding: '5px 10px',
borderRadius: '4px',
fontSize: '12px',
zIndex: 9999,
display: 'none',
transition: 'opacity 0.3s',
pointerEvents: 'none'
}
if (icon) {
if (icon.startsWith('fa-')) {
vNodes.push(<i class={`fa ${icon}`} />)
Expand All @@ -47,55 +34,9 @@ export default {
}
if (title) {
const titleSpan = (
<span
slot='title'
style={ellipsisStyle}
onMouseenter={(e) => {
const el = e.target
const tooltip = el.querySelector('.menu-tooltip')
// 检查文本是否溢出
if (el.scrollWidth > el.offsetWidth) {
const rect = el.getBoundingClientRect()
tooltip.style.left = rect.right + 10 + 'px'
tooltip.style.top = rect.top + 'px'
tooltip.style.display = 'block'
}
}}
onMouseleave={(e) => {
const tooltip = e.querySelector('.menu-tooltip')
tooltip.style.display = 'none'
}}
>
{title}
<div class='menu-tooltip' style={tooltipStyle}>
{title}
<span class='tooltip-arrow'></span>
</div>
</span>
)
vNodes.push(titleSpan)
vNodes.push(<span slot='title' style={ellipsisStyle} title={ title }>{title}</span>)
}
return vNodes
}
}
</script>

<style>
.el-menu-item,
.el-submenu__title {
overflow: hidden !important;
white-space: nowrap !important;
}
.tooltip-arrow {
position: absolute;
left: -4px;
top: 50%;
margin-top: -4px;
border: 4px solid transparent;
border-right-color: rgba(0, 0, 0, 0.8);
}
</style>

0 comments on commit 98aa11b

Please sign in to comment.