dropdown.vue: fix Pooper created multiple times

Fix the issue that the select component watch selectOptions causes Pooper to repeatedly create multiple times (the bound scroll event cannot be cleared), and the select component watch selectOptions is recommended to be throttled.
This commit is contained in:
webpack 2020-07-21 14:26:07 +08:00 committed by GitHub
parent edd93e3116
commit 3db31406a8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

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