📝: 更新日志

This commit is contained in:
就眠儀式
2022-05-01 01:17:31 +08:00
parent afc3de03c7
commit c31f944865
8 changed files with 98 additions and 49 deletions

View File

@@ -1,7 +1,7 @@
<script lang="ts">
export default {
name: "StandardVue"
}
name: "StandardVue",
};
</script>
<script setup lang="ts">

View File

@@ -1,7 +1,7 @@
<script lang="ts">
export default {
name: "StandardRange"
}
name: "StandardRange",
};
</script>
<script setup lang="ts">

View File

@@ -1,7 +1,7 @@
<script lang="ts">
export default {
name: "Vertical"
}
name: "Vertical",
};
</script>
<script setup lang="ts">

View File

@@ -1,7 +1,7 @@
<script lang="ts">
export default {
name: "VerticalRange"
}
name: "VerticalRange",
};
</script>
<script setup lang="ts">

View File

@@ -0,0 +1,38 @@
<template>
<th
v-if="tableColumnKeys.includes(column.key)"
class="layui-table-cell"
:style="{
textAlign: column.align,
flex: column.width ? '0 0 ' + column.width : '1',
}"
>
<span>
<template v-if="column.titleSlot">
<slot :name="column.titleSlot"></slot>
</template>
<template v-else>
{{ column.title }}
</template>
</span>
<!-- 插槽 -->
<slot></slot>
</th>
</template>
<script lang="ts">
export default {
name: "Column",
};
</script>
<script lang="ts" setup>
export interface LayTableProps {
column?: any;
tableColumnKeys?: any;
}
const props = withDefaults(defineProps<LayTableProps>(), {
});
</script>

View File

@@ -5,6 +5,7 @@ export default {
</script>
<script setup lang="ts">
import Column from "./Column.vue";
import { ref, watch, useSlots, withDefaults, onMounted } from "vue";
import { v4 as uuidv4 } from "../../utils/guidUtil";
import { Recordable } from "../../types";
@@ -56,6 +57,19 @@ const tableColumnKeys = ref(
})
);
const tableColumns1 = [];
/**
* 复杂表头
*
* 思路:将 Column 处理为多级别 tr。
*/
tableColumns.value.forEach((tableColumn) => {
})
watch(
() => props.dataSource,
() => {
@@ -268,27 +282,12 @@ onMounted(() => {
/>
</div>
</th>
<template v-for="column in columns" :key="column">
<th
class="layui-table-cell"
:style="{
textAlign: column.align,
flex: column.width ? '0 0 ' + column.width : '1',
}"
v-if="tableColumnKeys.includes(column.key)"
>
<span>
<template v-if="column.titleSlot">
<slot :name="column.titleSlot"></slot>
</template>
<template v-else>
{{ column.title }}
</template>
</span>
<template v-for="column in columns" :key="column">
<column :tableColumnKeys="tableColumnKeys" :column="column">
<span
v-if="column.sort"
class="layui-table-sort layui-inline"
lay-sort=""
lay-sort
>
<i
@click.stop="sortTable($event, column.key, 'asc')"
@@ -301,7 +300,7 @@ onMounted(() => {
title="降序"
></i>
</span>
</th>
</column>
</template>
</tr>
</thead>