鼠标事件之间的区别

Difference Between MouseEvents

我是 Purescript 的新手。我正在使用来自 "import DOM.HTML.Event.EventTypes" 我无法理解 Mouseup、Mousedown、Mouseout 和 Mouseleave 之间的区别。 我搜索了文档,但找不到解释。 我想知道它们何时被触发。

按下鼠标按钮时发生 MouseDown,释放按钮时发生 MouseUp。 MouseLeave 在鼠标指针离开与侦听器关联的元素时发生。

您可以在此处查看 Web 事件列表的文档: https://developer.mozilla.org/en-US/docs/Web/Events

https://developer.mozilla.org/en-US/docs/Web/Events/mouseleave 所述:

mouseleave and mouseout are similar but differ in that mouseleave does not bubble and mouseout does. This means that mouseleave is fired when the pointer has exited the element and all of its descendants, whereas mouseout is fired when the pointer leaves the element or leaves one of the element's descendants (even if the pointer is still within the element).

还有一个通常最容易使用的click事件。