[Vuejs]-"[Violation] 'click' handler took 43665ms" in vue.js

3👍

The reason why you are getting this violation warning is likely because the event handler doesn’t return until the print page is closed. So, when you click the button the print page opens, then nothing happens until the print page is closed, then the function returns.

👤Genie

0👍

I used onmouseover and Chrome doesn’t show the violation, but Performance say Warning.
enter image description here

printScreen() {
        let value = this.$refs.printparts;
        let printPage = window.open();
        printPage.focus();
        printPage.document.body.insertAdjacentHTML('afterbegin', value.outerHTML);
        printPage.onmouseover = function() {
          printPage.print();
          printPage.close();
        };
        return false;
      },
👤Tom

Leave a comment