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:
parent
edd93e3116
commit
3db31406a8
1 changed files with 11 additions and 12 deletions
|
@ -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) {
|
||||
|
|
Loading…
Add table
Reference in a new issue