【发布时间】:2022-01-01 16:15:42
【问题描述】:
我在 svelte 中创建了一些自定义组件,但我不明白如何将事件作为道具传递,例如 on:click、on:mouseup、on:whatever,我尝试了以下方式,但它们不起作用:
// button.svelte
// OnClick it's a prop but in this way, I need to pass every single event manually
<div on:click={OnClick} ></div>
或
// button.svelte
// I tried even in this way but it didn't really work
<div {...$$restProps} {...$$props} ></div>
【问题讨论】:
标签: javascript svelte svelte-component