Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/components/AFTableColumn/AFTableColumn.vue
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ export default {
},
// 列最小宽度
minWidth () {
if (!this.$attrs.label) return undefined
if (!this.isFit) return undefined
const maxOne = Math.max(this.minLength, this.$attrs.label.length * this.fontRate.CHAR_RATE) * this.fontSize + 20
if (!this.$attrs.label || !this.isFit) return
const sortable = ![undefined, false].includes(this.$attrs.sortable)
const maxOne = Math.max(this.minLength, (this.$attrs.label.length + (sortable ? 1 : 0)) * this.fontRate.CHAR_RATE) * this.fontSize + 20
return this.$attrs.width || Math.max(maxOne, this.getComputedWidth)
},
// 字体大小
Expand Down
2 changes: 1 addition & 1 deletion src/views/AllFit/AllFit.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<el-table border stripe :data="$mockData.tableData" size="small">
<af-table-column label="占位列" prop="placeholder"></af-table-column>
<af-table-column label="可排序占位列" sortable prop="placeholder"></af-table-column>
<af-table-column label="贴边定宽100" prop="fix" width="100" fixed="left"></af-table-column>
<af-table-column label="定宽100少" prop="fixedLess" width="100"></af-table-column>
<af-table-column label="固定宽度100-多" prop="fixedMore" width="100"></af-table-column>
Expand Down