【问题标题】:How to add tooltip to table headers in element-ui (vue.js)?如何在 element-ui (vue.js) 中向表头添加工具提示?
【发布时间】:2019-06-10 23:10:00
【问题描述】:

我认为这会起作用,但它没有:

<template lang="pug">
  el-table(:data="myDataSet")
    el-table-column
      template(slot="label")
        el-tooltip(content="Verification of Reference")
          | VOR Status
      template(slot-scope="props")
        | {{ props.row.myData }}
</template>

请帮忙,谢谢。

【问题讨论】:

    标签: vue.js vuejs2 element-ui


    【解决方案1】:
    <el-table-column prop="value"
                     label="Value"
                     :render-header="renderPhaseHeader">
    </el-table-column>
    
    methods: {
      renderPhaseHeader(h, { column }) {
        return h('span', {
          class: 'class-name-if-you-want'
        }, [
          column.label + " ",
          h('el-tooltip', {
            class: 'class-name-if-you-want',
            attrs: {
              'content': 'message',
              'effect': 'light',
              'placement': 'top-start'
            }
          }, [
            h('i', {
              class: 'far fa-question-circle'
            })
          ])
        ])
      }
    }
    

    【讨论】:

      【解决方案2】:

      你可以使用 slot="header"

            <el-table-column>
              <template
                slot="header">
                <el-popover
                  ref="fromPopOver"
                  placement="top-start"
                  width="250"
                  trigger="hover">
                  <span>
                   Tooltip info here
                  </span>
                </el-popover>
                <span>Destination <i
                  v-popover:fromPopOver
                  class="el-icon-info
                  text-blue" />
                </span>
              </template>
              <template slot-scope="scope">
                <span>{{ scope.row.SomeData }}</span>
              </template>
      

      【讨论】:

        猜你喜欢
        • 2016-09-01
        • 1970-01-01
        • 1970-01-01
        • 2010-11-23
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2011-10-30
        相关资源
        最近更新 更多