|  | @@ -1,27 +1,36 @@
 | 
	
		
			
				|  |  |  <template>
 | 
	
		
			
				|  |  | -  <el-table ref="table" v-bind="$attrs" v-on="$listeners">
 | 
	
		
			
				|  |  | -    <el-table-column v-for="(column,idx) in visibleColumns" :key="idx" v-bind="col">
 | 
	
		
			
				|  |  | -      <template v-if="column.slotHeader" #header="{$index}">
 | 
	
		
			
				|  |  | -        <slot :name="column.slotHeader" v-bind="{ column, $index}">
 | 
	
		
			
				|  |  | -          {{ column.label }}
 | 
	
		
			
				|  |  | +  <el-table ref="table" :data="rows" v-bind="mergedAttrs" v-on="$listeners">
 | 
	
		
			
				|  |  | +    <dynamic-table-column v-for="column in visibleColumns" :key="column.prop" :column="column"
 | 
	
		
			
				|  |  | +                          :default-setting="columnDefaultSetting">
 | 
	
		
			
				|  |  | +      <template v-for="slot in Object.keys($scopedSlots)" #[slot]="scope">
 | 
	
		
			
				|  |  | +        <slot :name="slot" v-bind="scope">
 | 
	
		
			
				|  |  | +          {{ scope.display }}
 | 
	
		
			
				|  |  |          </slot>
 | 
	
		
			
				|  |  |        </template>
 | 
	
		
			
				|  |  | -      <template v-if="column.slotBody" #default="{row, $index}">
 | 
	
		
			
				|  |  | -        <slot :name="column.slotBody" v-bind="{row, column, $index, value: row[column.prop]}">
 | 
	
		
			
				|  |  | -          {{ row[column.prop] }}
 | 
	
		
			
				|  |  | -        </slot>
 | 
	
		
			
				|  |  | -      </template>
 | 
	
		
			
				|  |  | -    </el-table-column>
 | 
	
		
			
				|  |  | +    </dynamic-table-column>
 | 
	
		
			
				|  |  |    </el-table>
 | 
	
		
			
				|  |  |  </template>
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  <script>
 | 
	
		
			
				|  |  | +/*
 | 
	
		
			
				|  |  | +* NOTE:22.5.9 hht
 | 
	
		
			
				|  |  | +* 新的动态表格,支持多级嵌套与动态属性/事件
 | 
	
		
			
				|  |  | +* */
 | 
	
		
			
				|  |  | +import DynamicTableColumn from '@/components/dynamic-table/dynamic-table-column'
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  export default {
 | 
	
		
			
				|  |  |    name: 'dynamic-table',
 | 
	
		
			
				|  |  | +  components: { DynamicTableColumn },
 | 
	
		
			
				|  |  |    props: {
 | 
	
		
			
				|  |  | -    columns: { type: Array, default: () => [{ prop: '', slotBody: '', slotHeader: '' }] }
 | 
	
		
			
				|  |  | +    rows: { type: Array, default: () => [] },
 | 
	
		
			
				|  |  | +    columns: { type: Array, default: () => [] },
 | 
	
		
			
				|  |  | +    tableDefaultSetting: { type: Object, default: () => ({}) },
 | 
	
		
			
				|  |  | +    columnDefaultSetting: { type: Object, default: () => ({ align: 'center' }) }
 | 
	
		
			
				|  |  |    },
 | 
	
		
			
				|  |  |    computed: {
 | 
	
		
			
				|  |  | +    mergedAttrs() {
 | 
	
		
			
				|  |  | +      return { ...this.tableDefaultSetting, ...this.$attrs }
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  |      visibleColumns() {
 | 
	
		
			
				|  |  |        return this.columns.filter(col => col.hidden !== true)
 | 
	
		
			
				|  |  |      },
 |