(component): 新增 table 组件 even 属性, 用于开启斑马条纹

This commit is contained in:
就眠儀式
2022-06-26 23:24:05 +08:00
parent 129106705e
commit b1b3397951
3 changed files with 58 additions and 2 deletions

View File

@@ -27,7 +27,7 @@
.layui-table-tool,
.layui-table-total,
.layui-table-total tr,
.layui-table[lay-even] tr:nth-child(even) {
.layui-table.layui-table-even tr:nth-child(even) {
background-color: var(--global-neutral-color-1);
}

View File

@@ -29,6 +29,7 @@ export interface LayTableProps {
childrenColumnName?: string;
height?: number;
maxHeight?: string;
even?: boolean;
}
const props = withDefaults(defineProps<LayTableProps>(), {
@@ -39,6 +40,7 @@ const props = withDefaults(defineProps<LayTableProps>(), {
dataSource: () => [],
selectedKeys: () => [],
maxHeight: "auto",
even: false,
});
const tableId = uuidv4();
@@ -364,7 +366,7 @@ props.dataSource.map((value: any) => {
:style="{ height: height, maxHeight: maxHeight }"
ref="tableBody"
>
<table class="layui-table" :lay-size="size">
<table class="layui-table" :class="{'layui-table-even': props.even}" :lay-size="size">
<colgroup>
<col v-if="checkbox" class="layui-table-col-special" />
<template v-for="column in columns" :key="column">