这可能是因为您将mousemove事件侦听器添加到了单击事件侦听器中。为了确保mousemove事件在鼠标移动时触发,您需要将mousemove事件与单击事件分离。以下是一个示例:
在HTML模板中:
Click me
在组件中:
onButtonClick() { // Perform click event actions here }
onMouseMove() { // Perform mousemove event actions here }
上一篇:Angular的默认路由会给出空白页面而不是跳转到组件。
下一篇:Angular的nativeElement.scrollTop具有奇怪的行为