欢迎来到尧图网

客户服务 关于我们

您的位置:首页 > 文旅 > 旅游 > 解决Element-ui中Table表格里的show-overflow-tooltip不兼容safari浏览器问题

解决Element-ui中Table表格里的show-overflow-tooltip不兼容safari浏览器问题

2024/10/24 3:23:03 来源:https://blog.csdn.net/2201_75705263/article/details/141721679  浏览:    关键词:解决Element-ui中Table表格里的show-overflow-tooltip不兼容safari浏览器问题
<el-table :cell-style="getCellStyle">
....
</el-table>methods:{getCellStyle({column}){//TODO 针对Safari表格width与showOverflowTooltip暂不能共存异常const tempWidth = column.realWidth || column.width if(column.showOVerflowTooltip) {return {minWidth:tempWidth + 'px',maxWidth:tempWidth + 'px'}}return {}}
}

也就是minWidth,maxWidth兼容safari.

还有一种方法就是在源码中进行改,但是不建议使用

getColspanRealWidth(columns, colspan, index) {if (colspan < 1) {return columns[index].realWidth;}const widthArr = columns.map(({ realWidth }) => realWidth).slice(index, index + colspan);// (修改前)存在widthArr => null// return widthArr.reduce((acc, width) => acc + width, -1);// (修改后)过滤非法值 nullconst validArr = widthArr.filter(item => item)return validArr.length ? validArr.reduce((acc, width) => acc + width, -1) : null;},

更新包的时候就给搞没了,不建议使用

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com