欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

ElementUI表格中添加表头图标悬浮提示

程序员文章站 2022-06-22 14:42:41
本文主要介绍了elementui表格中添加表头图标悬浮提示,分享给大家,具体如下:

本文主要介绍了elementui表格中添加表头图标悬浮提示,分享给大家,具体如下:

ElementUI表格中添加表头图标悬浮提示

<el-table-column
    label="操作"
    fixed="right"
    :render-header="tableaction"
    width="120">
    <!--scope 即为 userlist  scope.row即为当前行数据 -->
    <template slot-scope="scope">
        <el-button @click="editcar(scope.row)" type="primary" icon="el-icon-edit" size="small" circle></el-button>
        <el-button @click="delcar(scope.row.carid)" type="danger"
                   icon="el-icon-delete" circle size="small"></el-button>
    </template>
</el-table-column>
 //表格操作提示
 tableaction() {
     return this.$createelement('helphint', {
         props: {
             content: '编辑车辆 / 删除车辆'
         }
     }, '操作');
 },

切记导入

import helphint from ‘~/components/helphint/helphint.vue';

并在 components中引入

helphint.vue 组件内容

<template>
  <span>
    <span style="margin-right: 8px"><slot></slot></span>
    <el-tooltip :content="content" :placement="placement">
      <i class="el-icon-question" style="cursor: pointer;"></i>
    </el-tooltip>
  </span>
</template>
<script>
  export default {
    name: 'helphint',
    props: {
      placement: {
        default: 'top'
      },
      content: string,
    },
    data() {
      return {}
    },
  }
</script>

到此这篇关于elementui表格中添加表头图标悬浮提示的文章就介绍到这了,更多相关element  图标悬浮提示内容请搜索以前的文章或继续浏览下面的相关文章希望大家以后多多支持!