feat(table): columns 配置 新增 customSlot 自定义插槽

This commit is contained in:
就眠仪式
2021-10-10 15:22:07 +08:00
parent 402fb53d8b
commit 1675a4f06a
3 changed files with 26 additions and 49 deletions

View File

@@ -3635,7 +3635,6 @@ a cite {
.layui-table-view .layui-table {
position: relative;
width: auto;
margin: 0;
border-collapse: separate
}

View File

@@ -70,8 +70,24 @@
</div>
</td>
<template v-for="(value, key, index) in data" :key="index">
<template v-for="column in columns" :key="column">
<template v-for="column in columns" :key="column">
<template v-if="column.customSlot">
<td>
<div
:style="{ width: column.width }"
style="padding: 0px 16px"
>
<slot :name="column.customSlot" :data="data"></slot>
</div>
</td>
</template>
<template
v-else
v-for="(value, key, index) in data"
:key="index"
>
<td v-if="column.key == key">
<div
:style="{ width: column.width }"
@@ -84,6 +100,7 @@
</div>
</td>
</template>
</template>
</tr>
</template>