当前位置: 首页 > news >正文

网站开发网络公司flash 网站头部

网站开发网络公司,flash 网站头部,耒阳市古雍网站建设店,怎么样申请网站eltable 合计行添加tooltip 问题描述#xff1a; eltable 合计行单元格内容过长会换行#xff0c;需求要求合计行数据超长显示 … #xff0c;鼠标 hover 时显示提示信息。 解决方案#xff1a;eltable合计行没有对外的修改接口#xff0c;想法是 自己实现一个tooltip eltable 合计行单元格内容过长会换行需求要求合计行数据超长显示 … 鼠标 hover 时显示提示信息。 解决方案eltable合计行没有对外的修改接口想法是 自己实现一个tooltip 为合计行单元添加鼠标移入移出事件移入显示tooltip移出隐藏tooltiptooltip的定位和内容通过移入时拿到单元格位置和内容。 实现代码 最后有优化代码 templatediv classcontentel-table show-summary :datadatael-table-columnv-foritem in headerv-binditem:show-overflow-tooltiptrue/el-table-column/el-table!-- 自定义tooltip --Transition nameel-fade-indiv v-showtoolTipVisble idcustomTooltip refcustomTooltip{{ tipMsg }}div classpopper__arrow/div/div/Transition/div /templatescript export default {components: {},data() {return {//合计行提示toolTipVisble: false,tipMsg: ,header: [{ label: 列1, prop: col1, width: 70px },{ label: 列2, prop: col2, width: 70px },{ label: 列3, prop: col3, width: 70px },{ label: 列4, prop: col4, minWidth: 70px },],data: [{col1: 23333333333333,col2: 2345679,col3: 66666666666666,col4: 4,},{ col1: 2, col2: 2, col3: 3, col4: 4 },{ col1: 2, col2: 2, col3: 3, col4: 4 },{ col1: 2, col2: 2, col3: 3, col4: 4 },{ col1: 2, col2: 2, col3: 3, col4: 4 },],};},mounted() {this.setSummaryListener();},methods: {setSummaryListener() {let that this;let table document.querySelector(.el-table__footer-wrappertable);this.$nextTick(() {for (let rowIndex 0; rowIndex table.rows.length; rowIndex) {let row table.rows[rowIndex].cells;for (let colIndex 0; colIndex row.length; colIndex) {let col row[colIndex];let cells col.getElementsByClassName(cell);if (cells cells.length 0) {let cell cells[0];if (cell.scrollWidth cell.offsetWidth) {cell.onmouseenter function () {that.setTooltip(true, rowIndex, colIndex, cell);};cell.onmouseleave function () {that.setTooltip(false, rowIndex, colIndex, cell);};}}}}});},setTooltip(isShow, rowIndex, columnIndex, colEl) {this.toolTipVisble isShow;if (isShow) {this.tipMsg colEl.innerText || colEl.textContent;let toolTip this.$refs.customTooltip;let rect colEl.getBoundingClientRect();//向上偏移量const offsetTop 50;toolTip.style.top rect.top - offsetTop px;this.$nextTick(() {const cellBorderWidth 1;toolTip.style.left rect.left -(toolTip.offsetWidth / 2 -(colEl.offsetWidth cellBorderWidth * 2) / 2) px;});}},}, }; /scriptstyle /* 合计行单元格样式 */ .el-table__footer-wrapper .el-table__footer .el-table__cell .cell {overflow: hidden;text-overflow: ellipsis;word-break: break-all;white-space: nowrap; } /stylestyle langscss scoped #customTooltip {position: absolute;transform-origin: center bottom;background: #303133;color: #fff;border-radius: 4px;padding: 10px;font-size: 12px;line-height: 1.2;word-wrap: break-word;.popper__arrow {position: absolute;display: block;width: 0px;height: 0px;bottom: -12px;left: 42%;border-left: 6px solid transparent;border-right: 6px solid transparent;border-bottom: 6px solid transparent;border-top: 6px solid #303133;} } .content {display: flex;flex-direction: column;width: 100%;height: 500px; } /style实现效果 瞅瞅源码 eltable 数据行单元格提示信息show-overflow-tooltip源码实现思路跟上面差不多。 单元格的提示信息也是绑定鼠标移入移出事件提示信息用的el-tooltip。 el-tooltip这里el-tooltip标签里面没有内容之后通过鼠标移入事件绑定。 单元格绑定鼠标事件 referenceElm 绑定目标对象提示信息定位对象。 优化一下我自己写的tooltip用el-tooltip实现。 templatediv classcontentel-table show-summary :datadatael-table-columnv-foritem in headerv-binditem:show-overflow-tooltiptrue/el-table-column/el-table!-- 自定义tooltip --!-- Transition nameel-fade-indiv v-showtoolTipVisble idcustomTooltip refcustomTooltip{{ tipMsg }}div classpopper__arrow/div/div/Transition --el-tooltipplacementtopreftooltip:contenttooltipContent/el-tooltip/div /templatescript export default {components: {},data() {return {tooltipContent: ,header: [{ label: 列1, prop: col1, width: 70px },{ label: 列2, prop: col2, width: 70px },{ label: 列3, prop: col3, width: 70px },{ label: 列4, prop: col4, minWidth: 500px },],data: [{col1: 23333333333333,col2: 2345679,col3: 66666666666666,col4: 4,},{ col1: 2, col2: 2, col3: 3, col4: 4 },{ col1: 2, col2: 2, col3: 3, col4: 4 },{ col1: 2, col2: 2, col3: 3, col4: 4 },{ col1: 2, col2: 2, col3: 3, col4: 4 },],};},mounted() {this.setSummaryListener();},methods: {setSummaryListener() {let that this;let table document.querySelector(.el-table__footer-wrappertable);this.$nextTick(() {for (let rowIndex 0; rowIndex table.rows.length; rowIndex) {let row table.rows[rowIndex].cells;for (let colIndex 0; colIndex row.length; colIndex) {let col row[colIndex];let cells col.getElementsByClassName(cell);if (cells cells.length 0) {let cell cells[0];if (cell.scrollWidth cell.offsetWidth) {cell.onmouseenter function () {that.setTooltip(true, rowIndex, colIndex, cell);};cell.onmouseleave function () {that.setTooltip(false, rowIndex, colIndex, cell);};}}}}});},setTooltip(isShow, rowIndex, columnIndex, colEl) {const tooltip this.$refs.tooltip;if (isShow) {this.tooltipContent colEl.innerText || colEl.textContent;tooltip.referenceElm colEl;tooltip.$refs.popper (tooltip.$refs.popper.style.display none);tooltip.doDestroy();tooltip.setExpectedState(true);tooltip.handleShowPopper();} else {tooltip.setExpectedState(false);tooltip.handleClosePopper();}},}, }; /scriptstyle /* 合计行单元格样式 */ .el-table__footer-wrapper .el-table__footer .el-table__cell .cell {overflow: hidden;text-overflow: ellipsis;word-break: break-all;white-space: nowrap; } /stylestyle langscss scoped .content { width: 100%;height: 500px; } /style
http://www.hkea.cn/news/14540377/

相关文章:

  • 免费做网站的网站长沙建站公司模板
  • 做网站要备案吗 要几天网站设计济南
  • 用jsp做的网站代码上海做网站最低价
  • 山西省大同市网站建设公司重庆做网站开发的公司有哪些
  • 网站里添加图片超链接怎么做软件设计工资一般多少
  • 做企业网站申请域名百度指数查询工具
  • 爬虫做网站相关教程wordpress文章付费阅读设置
  • 广安们内网站建设Lms wordpress功能
  • 中山服装网站建设东莞阳光官方网
  • 关于网站建设的职位北京怎样做企业网站
  • 台州网站公司网站建设使页面内容居中
  • wordpress给公司建站优秀设计案例网站
  • 自己能建设网站吗wordpress表单反馈
  • 帮齐家网做的网站浅谈电子商务网站的建设与管理
  • 滴滴出行的网站是哪家公司做的网站设计的国际专业流程
  • 无锡网站制作启手机开发人员选项怎么设置
  • 网站全站模板交易所网站开发实战
  • 公司没有备案了网站杭州滨江区抖音seo行情
  • 12306网站很难做吗温州产品推广网站
  • 做硅胶的网站wordpress 附件重命名
  • 宁波网站开发rswl长沙建设局网站
  • 网站设计主要做什么图片搜索图片识别
  • 北京一家专门做会所的网站怎样做网站全屏代码
  • 个人网站前置审批项高端品牌网站建设在哪济南兴田德润优惠吗
  • 彩票娱乐网站建设开发网站开发就是ssh吗
  • 做班级网站代码做外贸需要关注国外哪些网站
  • 金沙县建设局网站电信改公网ip可以做网站吗
  • 云南哪里有给做网站的织梦cms怎么做网站地图
  • 做网站 页面自适应商品价格网
  • 网站开发制作软件wordpress给公司建站