模拟鼠标点击

  1. const a = document.querySelector('a[href="#1"]');
  2. if (a) a.dispatchEvent(new MouseEvent('click', {bubbles: true}));