fix: 修复分辨率过小时,单词被拆开的问题

This commit is contained in:
刘洪洪
2023-03-28 18:13:20 +08:00
parent 4af4dc4260
commit 6405b06907
3 changed files with 14 additions and 7 deletions

View File

@@ -61,7 +61,11 @@ body {
}
}
// 单词换行不被拆开
.el-table .cell {
// 表头单词换行不被拆开
.el-table th > .cell {
word-break: keep-all !important;
}
// 表格内容换行,不对中文生效,避免中文出现省略号
.el-table .cell {
word-break: break-word !important;
}

View File

@@ -92,6 +92,7 @@ export default {
}, {
label: this.$t('overall.type'),
prop: 'tagType',
minWidth: 80,
show: true
}, {
label: this.$t('overall.remark'),

View File

@@ -55,7 +55,7 @@ export default {
}
list.forEach((item, index) => {
if (item.label) {
if (item.label && item.label !== 'IP') {
let tempLength = 0
if (item.label.indexOf(' ') > -1) {
@@ -72,20 +72,22 @@ export default {
// 为了避免没有minWidth这种情况
if (!item.minWidth) {
item.minWidth = newWidth
} else if (item.minWidth < newWidth) {
item.minWidth = newWidth
}
// 排序最后一位一般是'操作',或者是较长的字符,故不让其换行,宽度直接为字符宽度
if (index === list.length - 1) {
item.minWidth = (num * item.label.length) + 22
item.width = (num * item.label.length) + 22
}
// 有排序的额外添加24px的排序图标宽度
if (item.sortable) {
item.minWidth = item.minWidth + 30
item.width = item.width + 30
}
if (item.minWidth < newWidth) {
item.minWidth = newWidth
} else if (item.width < item.minWidth) {
item.width = item.minWidth
}
}
})