2.3.3
2.5.16
https://jsfiddle.net/mmx38qxw/1311/
<el-table-column :width="'25%'" prop="a" label="A"></el-table-column>
<colgroup>
<col name="el-table_1_column_1" width="25%">
</colgroup>
<colgroup>
<col name="el-table_1_column_1" width="25">
</colgroup>
Translation of this issue:
2.3.3
2.5.16
https://jsfiddle.net/mmx38qxw/1311/
```html
.
```html
```html
width
doesn't support percentage. A possible workaround: https://jsfiddle.net/leopoldthecuber/mmx38qxw/1398/ .
@Leopoldthecoder your proposed solution would imply to watch for resize events too.
that's how i do it:
{
data () {
return {
columnWidths: {
colA: 0.05,
colB: 0.2,
colC: 0.5,
colD: 0.25
},
width: {
colA: 0,
colB: 0,
colC: 0,
colD: 0
}
}
},
mounted () {
window.addEventListener('resize', this.calcColumnWidths)
this.calcColumnWidths()
},
beforeDestroy () {
window.removeEventListener('resize', this.calcColumnWidths)
},
methods: {
calcColumnWidths () {
const tableWidth = this.$refs.table.$el.clientWidth
for (let column of Object.keys(this.columnWidths)) {
this.width[column] = this.columnWidths[column] * tableWidth
}
}
}
}
I have encountered the same issue, and found the following information in the documentation: use min-width
instead of width
. It works in my use case.
From the documentation:
column minimum width. Columns with width has a fixed width, while columns with min-width has a width that is distributed in proportion
http://element.eleme.io/#/en-US/component/table
I have encountered the same issue, and found the following information in the documentation: use
min-width
instead ofwidth
. It works in my use case.From the documentation:
column minimum width. Columns with width has a fixed width, while columns with min-width has a width that is distributed in proportion
http://element.eleme.io/#/en-US/component/table
That's awesome, thank you!
Most helpful comment
I have encountered the same issue, and found the following information in the documentation: use
min-width
instead ofwidth
. It works in my use case.From the documentation:
http://element.eleme.io/#/en-US/component/table