(component): 处理 column 在 tree-table 无法传递的问题

This commit is contained in:
就眠儀式 2022-10-22 14:40:46 +08:00
parent 21c2b06d2c
commit 74ec3e108f
2 changed files with 14 additions and 7 deletions

View File

@ -622,11 +622,11 @@ const radioProps = props.getRadioProps(props.data, props.index);
v-model:selectedKeys="tableSelectedKeys"
v-model:selectedKey="tableSelectedKey"
>
<template v-for="name in slotsData" #[name]="slotProp: { data: any }">
<slot :name="name" :data="slotProp.data"></slot>
<template v-for="name in slotsData" #[name]="slotProp: { data: any, column: any }">
<slot :name="name" :data="slotProp.data" :column="slotProp.column"></slot>
</template>
<template v-if="slot.expand" #expand="slotProp: { data: any }">
<slot name="expand" :data="slotProp.data"></slot>
<template v-if="slot.expand" #expand="slotProp: { data: any, column: any }">
<slot name="expand" :data="slotProp.data" :column="slotProp.column"></slot>
</template>
</table-row>
</template>

View File

@ -685,7 +685,12 @@ onBeforeUnmount(() => {
:style="[{ 'padding-right': `${scrollWidthCell}px` }]"
>
<div class="layui-table-header-wrapper" ref="tableHeader">
<table class="layui-table" :lay-size="size" :lay-skin="skin" ref="tableHeaderTable">
<table
class="layui-table"
:lay-size="size"
:lay-skin="skin"
ref="tableHeaderTable"
>
<colgroup>
<template v-for="column in tableBodyColumns" :key="column">
<template v-if="tableColumnKeys.includes(column.key)">
@ -878,8 +883,10 @@ onBeforeUnmount(() => {
</tr>
</tbody>
</table>
<lay-empty v-if="tableDataSource.length == 0 && loading == false"></lay-empty>
<div :style="{'width': tableBodyEmptyWidth }"></div>
<lay-empty
v-if="tableDataSource.length == 0 && loading == false"
></lay-empty>
<div :style="{ width: tableBodyEmptyWidth }"></div>
<template v-if="loading == true">
<div class="layui-table-loading">
<i