表字段显示tip

需求背景:

生成的报表,前端只展示字段名称,计算逻辑没有解释,使用方频繁"骚扰",实在受不了,增加一个字段tip,实现效果(下图):

代码

结合使用el-table-column和ElTooltip,实现

单行tip

html 复制代码
<el-table-column label="缺勤日期" align="center" prop="billingDate" width="150" sortable >
        <template #header>
          <Tooltip
            message="商品销售汇总表中的帐单日期"
            title="缺勤日期"
          />
        </template>
      </el-table-column>

Tooltip实现

html 复制代码
<script lang="ts" setup>
import { propTypes } from '@/utils/propTypes'

defineOptions({ name: 'Tooltip' })

defineProps({
  title: propTypes.string.def(''),
  message: propTypes.string.def(''),
  icon: propTypes.string.def('ep:question-filled')
})
</script>
<template>
  <span>{{ title }}</span>
  <ElTooltip :content="message" placement="top">
    <Icon :icon="icon" class="relative top-1px ml-1px" />
  </ElTooltip>
</template>

多行tip

html 复制代码
<el-table-column label="收货单号" align="center" prop="receiptNumber" width="180" sortable >
        <template #header>
          <span>收货单号</span>
          <el-tooltip placement="top" effect="dark">
            <template #content>
              从收货单管理中,根据缺勤分析中"门店名称和缺勤商品的sku码",<br/>
              取此缺勤日期当日开始及之后最近一次的此商品收货单明细,<br/>
              填写:收货单号,创建日期、创建人、发货量、收货日期、净收货量;
            </template>
            <Icon :icon="icon" class="relative top-1px ml-1px" />
          </el-tooltip>
        </template>
      </el-table-column>
<script>
defineProps({
  icon: propTypes.string.def('ep:question-filled')
})
</script>

效果如下:

ps:ep:question-filled这个组件是显示?,可以自行定义,看你爱好

相关推荐
蜚鸣13 小时前
Vue的快速入门
vue
吃饭最爱2 天前
⽹络请求Axios的概念和作用
vue
魂尾ac2 天前
Django + Vue3 前后端分离技术实现自动化测试平台从零到有系列 <第一章> 之 注册登录实现
后端·python·django·vue
是罐装可乐2 天前
深入理解 Vue3 Router:三种路由模式的工作原理与实战应用
架构·vue·路由·history·hash·ssr·router
老华带你飞2 天前
租房平台|租房管理平台小程序系统|基于java的租房系统 设计与实现(源码+数据库+文档)
java·数据库·小程序·vue·论文·毕设·租房系统管理平台
zhz52143 天前
Spring Boot + Redis 缓存性能优化实战:从5秒到毫秒级的性能提升
java·spring boot·redis·缓存·vue
小胖墩有点瘦4 天前
【基于协同过滤的校园二手交易平台】
java·vue·毕业设计·springboot·计算机毕业设计·协同过滤·校园二手交易平台
小圣贤君4 天前
小说创作中的时间轴体验设计:事序图交互与用户体验优化
electron·vue·甘特图·时序图·写作软件
知识分享小能手4 天前
React学习教程,从入门到精通,React 构造函数(Constructor)完整语法知识点与案例详解(16)
前端·javascript·学习·react.js·架构·前端框架·vue
@AfeiyuO4 天前
分类别柱状图(Vue3)
typescript·vue·echarts