Module build failed (from ./node_modules/babel-loader/lib/index.js) SyntaxError Missing semicolon

  Kiến thức lập trình
    app.directive('scroll-bottom', {
      mounted(el, binding) {
        let timer: ReturnType<typeof setTimeout> | null = null;
        let preScrollTop = 0;
        el.addEventListener('scroll', () => {
          if (el.scrollHeight - el.scrollTop - 20 <= el.clientHeight && el.scrollTop > preScrollTop) {
            console.log('bottom');
            if (timer) {
              clearTimeout(timer);
            }
            timer = setTimeout(() => {
              binding.value();
            }, 300);
          }
          preScrollTop = el.scrollTop;
        });
      },
    });

enter image description here

Why is this error reported? I have a semicolon at the end of line 59.

I checked all the lines in this file and there is a semicolon at the end of each line.

dia anyone can help me?

Hope the code runs correctly.

New contributor

刘兆峰 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

LEAVE A COMMENT