Questions tagged «svelte-3»

5
如何将参数传递给on:在Svelte中单击?
将功能绑定到按钮既简单又直接: <button on:click={handleClick}> Clicks are handled by the handleClick function! </button> 但是在执行此操作时,我看不到将参数(参数)传递给函数的方法: <button on:click={handleClick("parameter1")}> Oh no! </button> 该函数在页面加载时调用,不再调用。 是否有可能将参数传递给从中调用的函数on:click{}? 编辑: 我只是找到了一种方法。从内联处理程序调用该函数即可。 <button on:click={() => handleClick("parameter1")}> It works... </button>
23 svelte  svelte-3 
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.