🔸<slot>
╱🚧 under construction -> default slot
使用方式
<template id="my-component-template">
<style>
.container {
border: 1px solid blue;
padding: 10px;
}
</style>
<div class="container">
<p>This is some default text.</p>
<!-- ⭐️ 1️⃣ 決定 <slot> 位置 -->
<slot></slot>
<p>This is more default text.</p>
</div>
</template><my-component>
<!-- ⭐️ 2️⃣ 加入 HTML 內容 -->
<!-- 沒有指定插槽名稱的,會放入 default slot -->
<h2>This is the slotted content!</h2>
<p>This is another paragraph inside the slot.</p>
</my-component>使用 slotchange 事件
slotchange 事件Last updated