是否有使用 Svelte 将事件绑定到 SVG 元素(如路径)的方法

Is there a method for binding events to SVG elements like path using Svelte

是否有使用 Svelte 将事件绑定到 SVG 元素(如路径)的方法?

我试过在路径元素上使用 on:hover 但没有效果。

没有"hover"事件,Javascript有"onmouseover"和"onmouseout"。
所以在 svelte 中你会使用 on:mouseover={handleMouseOver}.
这是一个 link 到 svg 的精巧示例:
https://svelte.dev/repl/170a4929993247aba2b16f18621729ab?version=3.23.2