show-overflow-tooltip失效
时间: 2023-12-20 13:32:41 浏览: 50
show-overflow-tooltip属性在el-table中失效的问题可以通过在作用域插槽中添加文字并将其隐藏来解决。具体的解决方案如下所示:
```html
<el-table-column :show-overflow-tooltip="true" align="center" prop="name" width="160px" label="名称">
<template slot-scope="scope">
<span style="display: block; overflow: hidden; height: 0;">{{scope.row.name}}</span>
<el-input placeholder="请输入" clearable v-model="scope.row.name"></el-input>
</template>
</el-table-column>
```
在这个解决方案中,我们在作用域插槽中添加了一个隐藏的span元素,并将其高度设置为0。这样,show-overflow-tooltip属性就可以正常工作,显示tooltip内容。
相关问题
show-overflow-tooltip不显示tooltip
show-overflow-tooltip属性用于在Element-UI的el-table表格中设置是否显示tooltip文本提示内容。根据提供的引用内容,show-overflow-tooltip属性不显示tooltip的原因可能有以下几种情况:
1. 属性替换问题:可能是show-overflow-tooltip属性的写法不正确。尝试将`:show-overflow-tooltip="true"`替换为`show-overflow-tooltip`。
2. 嵌套问题:show-overflow-tooltip属性需要在el-table-column标签内部嵌套使用才能生效。确保show-overflow-tooltip属性位于el-table-column标签内,并且在标签内部嵌套了其他标签。
以下是一个示例代码,展示如何正确使用show-overflow-tooltip属性:
```html
<el-table>
<el-table-column prop="cooperateStatus" label="状态" min-width="110" align="center">
<template slot-scope="scope">
<span v-if="scope.row.status == 0" show-overflow-tooltip>启用</span>
</template>
</el-table-column>
</el-table>
```
请注意,示例代码中的show-overflow-tooltip属性位于span标签上,并且span标签是在el-table-column标签内部嵌套的。
vue show-overflow-tooltip
Vue的show-overflow-tooltip是一个用于处理溢出内容显示提示的指令。当元素内容超出容器大小时,该指令可以在鼠标悬停时显示一个提示框,以展示完整的内容。
使用show-overflow-tooltip指令需要先安装vue-directive-tooltip插件。安装完成后,在需要应用该指令的元素上添加v-show-overflow-tooltip属性即可。
以下是show-overflow-tooltip的使用示例:
```html
<template>
<div class="container">
<div class="content" v-show-overflow-tooltip>
<!-- 内容 -->
</div>
</div>
</template>
<script>
import 'vue-directive-tooltip/dist/vueDirectiveTooltip.css';
import VueDirectiveTooltip from 'vue-directive-tooltip';
export default {
directives: {
showOverflowTooltip: VueDirectiveTooltip.showOverflowTooltip,
},
};
</script>
<style>
.container {
width: 200px;
height: 100px;
overflow: hidden;
}
.content {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
</style>
```
在上述示例中,我们创建了一个容器元素,设置了固定的宽度和高度,并将其内容超出容器大小。通过v-show-overflow-tooltip指令,当鼠标悬停在内容上时,将显示一个提示框,展示完整的内容。
相关推荐
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)