Merge pull request #592 from jhh678/patch-3

dropdown.vue: fix Pooper created multiple times
This commit is contained in:
Aresn 2021-01-20 14:57:07 +08:00 committed by GitHub
commit 69416ce4cd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -44,13 +44,11 @@
methods: { methods: {
update () { update () {
if (isServer) return; if (isServer) return;
if (this.popper) {
this.$nextTick(() => { this.$nextTick(() => {
if (this.popper) {
this.popper.update(); this.popper.update();
this.popperStatus = true; this.popperStatus = true;
});
} else { } else {
this.$nextTick(() => {
this.popper = new Popper(this.$parent.$refs.reference, this.$el, { this.popper = new Popper(this.$parent.$refs.reference, this.$el, {
eventsEnabled: false, eventsEnabled: false,
placement: this.placement, placement: this.placement,
@ -70,13 +68,13 @@
this.resetTransformOrigin(); this.resetTransformOrigin();
} }
}); });
});
} }
// set a height for parent is Modal and Select's width is 100% // set a height for parent is Modal and Select's width is 100%
if (this.$parent.$options.name === 'iSelect') { if (this.$parent.$options.name === 'iSelect') {
this.width = parseInt(getStyle(this.$parent.$el, 'width')); this.width = parseInt(getStyle(this.$parent.$el, 'width'));
} }
this.tIndex = this.handleGetIndex(); this.tIndex = this.handleGetIndex();
});
}, },
destroy () { destroy () {
if (this.popper) { if (this.popper) {