Skip to content

Commit 81eb401

Browse files
committed
fix: dropdown not update when slot change
1 parent 503d358 commit 81eb401

File tree

2 files changed

+14
-9
lines changed

2 files changed

+14
-9
lines changed

components/_util/ContainerRender.jsx

+7-1
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,18 @@ export default {
7171
}
7272
});
7373
},
74+
methods: {
75+
forceRender(p) {
76+
this.comProps = p;
77+
this.$forceUpdate();
78+
},
79+
},
7480
render() {
7581
return self.getComponent(this.comProps);
7682
},
7783
});
7884
} else {
79-
this._component.comProps = props;
85+
this._component.forceRender(props);
8086
}
8187
}
8288
},

components/vc-trigger/Trigger.jsx

+7-8
Original file line numberDiff line numberDiff line change
@@ -108,17 +108,10 @@ export default {
108108
watch: {
109109
popupVisible(val) {
110110
if (val !== undefined) {
111+
this.prevPopupVisible = this.sPopupVisible;
111112
this.sPopupVisible = val;
112-
this.prevPopupVisible = val;
113113
}
114114
},
115-
sPopupVisible() {
116-
this.$nextTick(() => {
117-
this.renderComponent(null, () => {
118-
this.afterPopupVisibleChange(this.sPopupVisible);
119-
});
120-
});
121-
},
122115
},
123116
deactivated() {
124117
this.setPopupVisible(false);
@@ -131,7 +124,13 @@ export default {
131124
},
132125

133126
updated() {
127+
const triggerAfterPopupVisibleChange = () => {
128+
if (this.sPopupVisible !== this.prevPopupVisible) {
129+
this.afterPopupVisibleChange(this.sPopupVisible);
130+
}
131+
};
134132
this.$nextTick(() => {
133+
this.renderComponent(null, triggerAfterPopupVisibleChange);
135134
this.updatedCal();
136135
});
137136
},

0 commit comments

Comments
 (0)