📝(table): update
This commit is contained in:
		
							parent
							
								
									876947c79e
								
							
						
					
					
						commit
						7f67012f13
					
				@ -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";
 | 
			
		||||
 | 
			
		||||
@ -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>
 | 
			
		||||
 | 
			
		||||
@ -912,10 +912,10 @@ export default {
 | 
			
		||||
 | 
			
		||||
:::
 | 
			
		||||
 | 
			
		||||
::: title 合并列值
 | 
			
		||||
::: title 开启统计
 | 
			
		||||
:::
 | 
			
		||||
 | 
			
		||||
::: demo 通过 `columns` 配置 `type:'number'` 开启序号列。
 | 
			
		||||
::: demo 通过 `columns` 配置 `totalRow` 开启行统计。
 | 
			
		||||
 | 
			
		||||
<template>
 | 
			
		||||
  <lay-table :columns="columns26" :dataSource="dataSource26"></lay-table>
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user