📝(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 LayInput from "../input/index.vue";
import LayDropdown from "../dropdown/index.vue"; import LayDropdown from "../dropdown/index.vue";
import { getMonth, getYear, getDay } from "./day"; import { getMonth, getYear, getDay } from "./day";
import { import { ref, watch, defineProps, defineEmits, reactive, provide } from "vue";
ref,
watch,
defineProps,
defineEmits,
reactive,
provide,
} from "vue";
import DatePanel from "./components/DatePanel.vue"; import DatePanel from "./components/DatePanel.vue";
import TimePanel from "./components/TimePanel.vue"; import TimePanel from "./components/TimePanel.vue";
import YearPanel from "./components/YearPanel.vue"; import YearPanel from "./components/YearPanel.vue";

View File

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

View File

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