获取您的自己的 Vue 服务器
App.vue
SlotComp.vue
main.js
 
<template>
  <h1>Local Component</h1>
  <p>App.vue controls how local data from the scoped slot is rendered.</p>
  <slot-comp v-slot="dataFromSlot">
    <h2>{{ dataFromSlot.lclData }}</h2>
  </slot-comp>
</template>

<script></script>

<style>
  #app {
    width: 300px;
  }
  h2 {
    background-color: lightgreen;
    padding: 10px;
  }
</style>                  
<template>
    <slot v-bind:lclData="data"></slot>
</template>

<script>
export default {
    data() {
        return {
            data: 'This is local data'
        }
    }
}
</script>

<style></style>                  
import { createApp } from 'vue'

import App from './App.vue'
import SlotComp from './components/SlotComp.vue'

const app = createApp(App)
app.component('slot-comp', SlotComp)
app.mount('#app')
                  
https://127.0.0.1:5173/