Commit 9bc6d894e4954eb724c61b68ced9187a8c95e550
1 parent
1f326307
Exists in
master
and in
1 other branch
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 | 61 | render(h, context) { |
| 62 | 62 | const props = context.props || {}; |
| 63 | 63 | let scopedSlots = context.scopedSlots || {}; |
| 64 | - // 如有默认插槽则相当于直接写el-table | |
| 65 | - if (scopedSlots.default) { | |
| 66 | - return h('el-table', context); | |
| 67 | - } | |
| 68 | 64 | const columns = props.columns || []; |
| 69 | 65 | // 通过columns快速生成el-table-column |
| 70 | 66 | const elTableColumns = createElTableColumns(h, context, columns); |
| ... | ... | @@ -72,6 +68,9 @@ export default { |
| 72 | 68 | const prependSlot = scopedSlots.prepend ? scopedSlots.prepend() : ''; |
| 73 | 69 | // 左侧插槽 |
| 74 | 70 | const leftSlot = scopedSlots.left ? scopedSlots.left() : ''; |
| 71 | + // 默认插槽 | |
| 72 | + const defaultSlot = scopedSlots.default ? scopedSlots.default() : ''; | |
| 73 | + delete scopedSlots.default; | |
| 75 | 74 | // 右侧插槽 |
| 76 | 75 | const rightSlot = scopedSlots.right ? scopedSlots.right() : ''; |
| 77 | 76 | // 后置插槽 |
| ... | ... | @@ -83,7 +82,7 @@ export default { |
| 83 | 82 | context.props.data = context.props.value; |
| 84 | 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 | 88 | </script> | ... | ... |