fix: 修改asset 自定义label 作为表头时 有时会换行的问题

This commit is contained in:
zhangyu
2021-09-13 17:35:45 +08:00
parent 27cd1031a2
commit af0388c2b5
2 changed files with 18 additions and 0 deletions

View File

@@ -93,6 +93,18 @@ export default {
},
// 点击第二个cancel
save () {
if (this.tableId == 'assetTable') {
let customAssetLabel = false
this.custom.forEach(item => {
if (customAssetLabel) {
item.minWidth = item.label.length * 16 + 20
return
}
if (item.label === 'Label' && item.type == 'title') {
customAssetLabel = true
}
})
}
this.$emit('update', this.custom)
localStorage.setItem(
'nz-tableTitle-' + localStorage.getItem('nz-username') + '-' + this.tableId,

View File

@@ -286,10 +286,16 @@ export default {
})
if (localStorageTableTitle && (localStorageTableTitle.length > this.$refs.dataTable.tableTitle.length)) {
const arr = localStorageTableTitle.splice(this.$refs.dataTable.tableTitle.length, localStorageTableTitle.length)
arr.forEach(item => {
item.minWidth = item.label.length * 16 + 20
})
this.tools.customTableTitle = this.tools.customTableTitle.concat(arr)
}
if (!this.fromBottom) {
this.getTableData()
this.$nextTick(() => {
this.$refs.dataTable.$refs.dataTable.doLayout()
})
}
},
beforeDestroy () {