🔸<slot>
╱🚧 under construction -> default slot
named slot:可控制內容的插入位置。
fallback content:
<slot>
的預設內容。
使用方式
📁 自訂元素的 <template> 中:定義 <slot>
的位置(也可以放 named slot)
使用 slotchange
事件
slotchange
事件當 <slot>
的內容發生變化時(如插入或移除 slotted nodes ),就會觸發 slotchange 這個事件。你可以使用這個事件來監聽 slotted nodes 的變化,並執行相應的操作。
Last updated
Was this helpful?