我有以下要素:
Parent.svelte个
<script>
import Child from './Child.svelte';
function handleMouse(){
}
</script>
<Child on:mousedown={handleMouseDown} on:mouseover={handleMouse}/>
<div draggable="true" on:mousedown={handleMouseDown} on:mouseover={handleMouse}>Text</div>
Child.svelte个
<div draggable="true">Child text</div>
当handleMouse()
函数位于父组件中时,如何使该函数在子组件上起作用?
我可以在子组件中重新创建函数,但有没有一种方法可以只绑定到子元素的父函数?