Table: fix table header slot not reactive #21297

pull/22565/head
zhengzhongwen 2023-06-13 15:03:21 +08:00
parent f14b5ba540
commit 23a58931cd
1 changed files with 9 additions and 0 deletions

View File

@ -306,6 +306,15 @@ export default {
owner.store.commit('insertColumn', this.columnConfig, columnIndex, this.isSubColumn ? parent.columnConfig : null);
},
beforeUpdate() {
if (this.$slots.header && this.$scopedSlots.header) {
this.columnConfig.renderHeader = (h, scope) => {
const renderHeader = this.$scopedSlots.header;
return renderHeader ? renderHeader(scope) : this.columnConfig.label;
};
}
},
destroyed() {
if (!this.$parent) return;
const parent = this.$parent;