表字段显示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这个组件是显示?,可以自行定义,看你爱好

相关推荐
AI源码2 天前
高校查分系统
vue
北城笑笑4 天前
Vue 109 ,从零搭建 Vue3 + Electron 工程:生态、安全桥接与打包选型( Vue + Electron )
前端·javascript·vue.js·安全·electron·vue
上海懒图科技6 天前
工厂厂区电子地图定位导航:厂区人车精准定位,安全合规双保障
前端·arcgis·vue
卋罖7509 天前
Razor 视图 + JavaScript + Vue/iView 组件实现的表格自定义列
javascript·vue·iview·razor视图
无所谓^_^12 天前
个人健康管理系统 | Springboot3 | Vue3
java·vue·毕业设计·springboot·课程设计·毕设·前后端分离
在努力的前端小白13 天前
基于FastAPI+LangChain+LangGraph+Agent+多模态的AI Agent 有渔渔具网站
人工智能·langchain·vue·fastapi
sun_weitao13 天前
用 FastAPI + MQTT 做一个 ESP32最小化跑通示例
中间件·vue·fastapi
汤米粥17 天前
2026年主流前端技术框架
vue·react·elementplus·tailwind css·angular‌·svelte‌·bootstrap‌
codigger17 天前
Vue nextTick 到底在等什么?一篇讲透原理与那些年踩过的坑
程序员·vue·编程·异步更新·#人工智能
咚咚咚小柒18 天前
【前端】LangChain.js学习
前端·javascript·人工智能·typescript·langchain·vue·ai编程