fix: dropdown not update when slot change

pull/2081/head
tanjinzhou 2020-04-10 18:30:38 +08:00
parent 503d358188
commit 81eb401a88
2 changed files with 14 additions and 9 deletions

View File

@ -71,12 +71,18 @@ export default {
} }
}); });
}, },
methods: {
forceRender(p) {
this.comProps = p;
this.$forceUpdate();
},
},
render() { render() {
return self.getComponent(this.comProps); return self.getComponent(this.comProps);
}, },
}); });
} else { } else {
this._component.comProps = props; this._component.forceRender(props);
} }
} }
}, },

View File

@ -108,17 +108,10 @@ export default {
watch: { watch: {
popupVisible(val) { popupVisible(val) {
if (val !== undefined) { if (val !== undefined) {
this.prevPopupVisible = this.sPopupVisible;
this.sPopupVisible = val; this.sPopupVisible = val;
this.prevPopupVisible = val;
} }
}, },
sPopupVisible() {
this.$nextTick(() => {
this.renderComponent(null, () => {
this.afterPopupVisibleChange(this.sPopupVisible);
});
});
},
}, },
deactivated() { deactivated() {
this.setPopupVisible(false); this.setPopupVisible(false);
@ -131,7 +124,13 @@ export default {
}, },
updated() { updated() {
const triggerAfterPopupVisibleChange = () => {
if (this.sPopupVisible !== this.prevPopupVisible) {
this.afterPopupVisibleChange(this.sPopupVisible);
}
};
this.$nextTick(() => { this.$nextTick(() => {
this.renderComponent(null, triggerAfterPopupVisibleChange);
this.updatedCal(); this.updatedCal();
}); });
}, },