本文主要介绍了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>

声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。