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

相关推荐
harrain1 天前
vue2开发环境搭建指南
vue
by__csdn2 天前
Electron+Vite:实现electron + vue3 + ts + pinia + vite高效跨平台开发指南
前端·javascript·vue.js·typescript·electron·node.js·vue
人工智能训练2 天前
前端框架选型破局指南:Vue、React、Next.js 从差异到落地全解析
运维·javascript·人工智能·前端框架·vue·react·next.js
李纲明4 天前
WordPress外贸成品网站的免费获取渠道
vue·php
加洛斯4 天前
前端小知识002:ref 与 reactive 详解
前端·vue
计算机毕设vx_bysj68695 天前
计算机毕业设计必看必学~Springboot教学进度管理系统,原创定制程序、单片机、java、PHP、Python、小程序、文案全套、毕设成品等!
java·spring boot·vue·课程设计·管理系统
小贺要学前端5 天前
【无标题】
前端·javascript·vue·技术趋势
IT教程资源C6 天前
(N_141)基于springboot,vue网上拍卖平台
mysql·vue·前后端分离·拍卖系统·springboot拍卖
IT教程资源C6 天前
(N_144)基于微信小程序在线订餐系统
mysql·vue·uniapp·前后端分离·订餐小程序·springboot订餐
合作小小程序员小小店6 天前
web网页开发,在线短视频管理系统,基于Idea,html,css,jQuery,java,springboot,mysql。
java·前端·spring boot·mysql·vue·intellij-idea