Commit 9bc6d894e4954eb724c61b68ced9187a8c95e550

Authored by liuhanchen
1 parent 1f326307

feat: 修复旧版表格兼容性

Showing 1 changed file with 4 additions and 5 deletions   Show diff stats
packages/table/normal.vue
@@ -61,10 +61,6 @@ export default { @@ -61,10 +61,6 @@ export default {
61 render(h, context) { 61 render(h, context) {
62 const props = context.props || {}; 62 const props = context.props || {};
63 let scopedSlots = context.scopedSlots || {}; 63 let scopedSlots = context.scopedSlots || {};
64 - // 如有默认插槽则相当于直接写el-table  
65 - if (scopedSlots.default) {  
66 - return h('el-table', context);  
67 - }  
68 const columns = props.columns || []; 64 const columns = props.columns || [];
69 // 通过columns快速生成el-table-column 65 // 通过columns快速生成el-table-column
70 const elTableColumns = createElTableColumns(h, context, columns); 66 const elTableColumns = createElTableColumns(h, context, columns);
@@ -72,6 +68,9 @@ export default { @@ -72,6 +68,9 @@ export default {
72 const prependSlot = scopedSlots.prepend ? scopedSlots.prepend() : ''; 68 const prependSlot = scopedSlots.prepend ? scopedSlots.prepend() : '';
73 // 左侧插槽 69 // 左侧插槽
74 const leftSlot = scopedSlots.left ? scopedSlots.left() : ''; 70 const leftSlot = scopedSlots.left ? scopedSlots.left() : '';
  71 + // 默认插槽
  72 + const defaultSlot = scopedSlots.default ? scopedSlots.default() : '';
  73 + delete scopedSlots.default;
75 // 右侧插槽 74 // 右侧插槽
76 const rightSlot = scopedSlots.right ? scopedSlots.right() : ''; 75 const rightSlot = scopedSlots.right ? scopedSlots.right() : '';
77 // 后置插槽 76 // 后置插槽
@@ -83,7 +82,7 @@ export default { @@ -83,7 +82,7 @@ export default {
83 context.props.data = context.props.value; 82 context.props.data = context.props.value;
84 delete context.props.value; 83 delete context.props.value;
85 } 84 }
86 - return h('el-table', renderContext(context), [prependSlot, leftSlot, ...elTableColumns, rightSlot, appendSlot]); 85 + return h('el-table', renderContext(context), [prependSlot, leftSlot, ...elTableColumns, defaultSlot, rightSlot, appendSlot]);
87 }, 86 },
88 }; 87 };
89 </script> 88 </script>