直接上代码:
<template>
<el-tooltip effect="dark" placement="top-start" :disabled="disabled">
<div slot="content" :style="{ 'max-width': maxWidth + 'px' }">
{
{ text }}
</div>
<div :style="style" @mouseenter="showTips($event)">
{
{ text }}
</div>
</el-tooltip>
</template>
<script>
export default {
name: "TextTooltip",
props: {
// 文字内容
text: {
default: "",
},
// 超出多少行省略
lineClamp: {
type: Number,
default: 2,
},
// tooltip最大宽度限制
maxWidth: {
type: Number,
default: 400,
},
},
data() {
return {
disabled: true,
};
},
computed: {
style() {
return {
disp