news 2026/3/1 19:50:30

表头标题表头

作者头像

张小明

前端开发工程师

1.2k 24
文章封面图
表头标题表头
// customTooltip 组件 <template> <div @mouseenter="handleMouseenter" style="width: 100%"> <el-tooltip placement="top" :disabled="disabled" :content="props.content" @mouseleave="mouseleave" popper-class="tooltip"> <slot></slot> </el-tooltip> </div> </template> <script setup lang="ts"> import { ref } from 'vue' const props = defineProps({ content: { type: String, default: '', }, }) const disabled = ref(true) const handleMouseenter = (e: any) => { if (!props.content) { return } const cellChild = e.target.children[0] // range 表示文档的一个区域 const range = document.createRange() range.setStart(cellChild, 0) range.setEnd(cellChild, cellChild.childNodes.length) const flag = getStyle(cellChild, '-webkit-line-clamp') console.log(flag) if (flag == 'none') { // rangeWidth 表示元素内容的宽度 const rangeWidth = range.getBoundingClientRect().width let padding = (parseInt(getStyle(cellChild, 'paddingLeft')) || 0) + (parseInt(getStyle(cellChild, 'paddingRight')) || 0) // cellChild.offsetWidth 表示选定区域的宽度 if (rangeWidth > cellChild.offsetWidth - padding) { // 显示tooltip disabled.value = false } else { disabled.value = true } } else { // rangeHeight 表示元素内容的高度 const rangeHeight = range.getBoundingClientRect().height let padding = (parseInt(getStyle(cellChild, 'paddingTop')) || 0) + (parseInt(getStyle(cellChild, 'paddingBottom')) || 0) // cellChild.offsetHeight 表示选定区域的高度 if (rangeHeight > cellChild.offsetHeight - padding) { // 显示tooltip disabled.value = false } else { disabled.value = true } } } const mouseleave = () => { disabled.value = true } // 获取dom的样式 const getStyle = (dom: any, attr: any) => { return getComputedStyle(dom, null)[attr] } </script> <style lang="scss"> .tooltip { position: relative; z-index: 9999999 !important; } </style>
版权声明: 本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若内容造成侵权/违法违规/事实不符,请联系邮箱:809451989@qq.com进行投诉反馈,一经查实,立即删除!
网站建设 2026/3/1 11:54:22

使用javascript进行内网大附件上传的详解及代码示例?

来自一名"预算紧张"程序员的求助信 各位大神们好啊&#xff01;(拱手) 我是一名浙江的Java程序员&#xff0c;最近接了个"惊天地泣鬼神"的大项目——20G文件上传下载系统&#xff01;客户要求还挺多&#xff0c;但最让我感动的是预算&#xff1a;整整100…

作者头像 李华
网站建设 2026/2/21 23:15:54

(2026 学生版)学术写作 AI 论文工具排行榜

&#x1f3c6; 3 个精选标题2026 学生党 AI 论文工具性价比 TOP 榜&#xff1a;PaperRed 领衔&#xff0c;免费 / 低成本高效搞定学术写作预算有限也能当学霸&#xff01;AI 论文工具排行榜&#xff08;含 PaperRed / 豆包 / DeepSeek 实测&#xff09;避坑指南 性价比之王&am…

作者头像 李华
网站建设 2026/2/21 7:25:04

全网热议!2026年最佳免费制作视频二维码推荐榜单

随着信息分享的需求不断增长&#xff0c;视频二维码成为2026年的热门选择。选择合适的工具制作视频二维码&#xff0c;可以大大提高信息传播的效率。各大工具具备简单的操作和多种功能&#xff0c;适合不同场景如教育培训和产品宣传。通过这些工具&#xff0c;用户可以轻松上传…

作者头像 李华