fix: 未设置 width 的 column 自动分配宽度

This commit is contained in:
就眠儀式 2022-04-19 01:04:39 +08:00
parent 8a94ba4511
commit 223c6ab0c6
2 changed files with 7 additions and 2 deletions

View File

@ -270,7 +270,11 @@ onMounted(() => {
<template v-for="column in columns" :key="column"> <template v-for="column in columns" :key="column">
<th <th
class="layui-table-cell" class="layui-table-cell"
:style="{ width: column.width, textAlign: column.align }" :style="{
width: column.width,
textAlign: column.align,
flex: column.width ? 'none' : 'auto',
}"
v-if="tableColumnKeys.includes(column.key)" v-if="tableColumnKeys.includes(column.key)"
> >
<span> <span>
@ -335,6 +339,7 @@ onMounted(() => {
:style="{ :style="{
width: column.width, width: column.width,
textAlign: column.align, textAlign: column.align,
flex: column.width ? 'none' : 'auto',
}" }"
> >
<slot :name="column.customSlot" :data="data"></slot> <slot :name="column.customSlot" :data="data"></slot>
@ -352,6 +357,7 @@ onMounted(() => {
:style="{ :style="{
width: column.width, width: column.width,
textAlign: column.align, textAlign: column.align,
flex: column.width ? 'none' : 'auto',
}" }"
> >
<span> {{ value }} </span> <span> {{ value }} </span>

View File

@ -270,7 +270,6 @@ export default {
} }
,{ ,{
title:"操作", title:"操作",
width: "180px",
customSlot:"operator", customSlot:"operator",
key:"operator" key:"operator"
} }