Element, drop-down position is misplaced and reported to: PopperJS is not a constructor in vue-popper. "

when elementUI uses select, the drop-down position is misplaced and TypeError: PopperJS is not a constructor
clipboard.png

is reported in vue-popper.
[Vue warn]: Error in event handler for "updatePopper": "TypeError: PopperJS is not a constructor"

found in

---> <ElSelectDropdown> at src/lib/ele-components/select/src/select-dropdown.vue
       <ElSelect> at src/lib/ele-components/select/src/select.vue
         <App> at example/App.vue
           <Root>

Source src/utils/vue-popper

updatePopper is the undefined
createPopper where TypeError: PopperJS is not a constructor "

is reported.

I don"t know what went wrong.
``
createPopper () {

  //...
  //   
  this.popperJS = new PopperJS(reference, popper, options);
  this.popperJS.onCreate(_ => {
    this.$emit("created", this);
    this.resetTransformOrigin();
    this.$nextTick(this.updatePopper);
  });
  if (typeof options.onUpdate === "function") {
    this.popperJS.onUpdate(options.onUpdate);
  }
  this.popperJS._popper.style.zIndex = PopupManager.nextZIndex();
  this.popperElm.addEventListener("click", stop);
},

updatePopper () {

  const popperJS = this.popperJS; // undefined!
  if (popperJS) {
    popperJS.update();
    if (popperJS._popper) {
      popperJS._popper.style.zIndex = PopupManager.nextZIndex();
    }
  } else {
    this.createPopper();
  }
},
Mar.02,2021

has been dealt with, it is a webpack configuration issue, and it would be nice to exclude the compilation of the incoming file popper.js from webpack.

it is possible that the imported js file has been compiled, and there will be a problem if it is compiled again.


your PopperJS should not be a constructor, but where it is referenced

.
Menu