📝(table): update

This commit is contained in:
就眠儀式 2022-07-19 05:19:00 +08:00
parent 876947c79e
commit 7f67012f13
3 changed files with 12 additions and 19 deletions

View File

@ -107,14 +107,7 @@ import { LayIcon } from "@layui/icons-vue";
import LayInput from "../input/index.vue";
import LayDropdown from "../dropdown/index.vue";
import { getMonth, getYear, getDay } from "./day";
import {
ref,
watch,
defineProps,
defineEmits,
reactive,
provide,
} from "vue";
import { ref, watch, defineProps, defineEmits, reactive, provide } from "vue";
import DatePanel from "./components/DatePanel.vue";
import TimePanel from "./components/TimePanel.vue";
import YearPanel from "./components/YearPanel.vue";

View File

@ -321,27 +321,27 @@ const renderFixedClassName = (column: any, columnIndex: number) => {
const hasTotalRow = computed(() => {
let b = false;
props.columns.forEach(item => {
if(item.totalRow) {
props.columns.forEach((item) => {
if (item.totalRow) {
b = true;
}
})
});
return b;
})
});
const renderTotalRowCell = (column: any) => {
if(column.totalRow) {
if(column.totalRow != true) {
if (column.totalRow) {
if (column.totalRow != true) {
return column.totalRow;
} else {
let total = 0;
tableDataSource.value.forEach(item => {
tableDataSource.value.forEach((item) => {
total = total + item[column.key];
})
});
return total;
}
}
}
};
</script>
<template>

View File

@ -912,10 +912,10 @@ export default {
:::
::: title 合并列值
::: title 开启统计
:::
::: demo 通过 `columns` 配置 `type:'number'` 开启序号列
::: demo 通过 `columns` 配置 `totalRow` 开启行统计
<template>
<lay-table :columns="columns26" :dataSource="dataSource26"></lay-table>