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

相关推荐
爱上纯净的蓝天1 天前
使用 AtomCode 构建微前端架构:从设计到实现实战
架构·vue·实战·react·微前端·atomcode
山海云端有限公司3 天前
随机诗词API实战:Vue项目接入完整示例与5个常见坑
vue·实战·前端开发·跨域·api调用·随机诗词api
暗冰ཏོ4 天前
Spring Boot + Vue3 订单支付模块技术实现:支付单、回调验签、幂等处理与余额扣减
前端·spring boot·后端·vue·微信支付·支付宝支付
万亿少女的梦1685 天前
基于Python的高考志愿填报辅助系统设计与实现
java·spring boot·python·mysql·vue
万亿少女的梦1685 天前
基于SpringBoot与Vue的历史博物馆展品展示与游客管理系统设计
spring boot·mysql·vue·系统设计·博物馆管理系统
衍生星球5 天前
SpringBoot3 + Vue3 + 微信小程序如何学习,以及学哪些技术,组件
sql·微信小程序·uni-app·vue·springboot
志尊宝6 天前
Vue3 环境搭建 + 第一个 HelloVue 项目(零基础入门)
vue.js·node.js·vue·css3
万亿少女的梦1686 天前
基于Spring Boot与Vue的繁星技术论坛系统设计与实现
java·spring boot·mysql·vue·系统设计
随心(cracker)6 天前
BeaverX Admin:一套真正能跑起来的开源管理后台
vue·.net·管理后台
万亿少女的梦1686 天前
基于SpringBoot的考研学习交流系统设计与开发
spring boot·mysql·vue·系统设计·论坛系统