Get your own Vue server
App.vue
CompOne.vue
CompTwo.vue
main.js
 
<template>
  <div>
    <h3>Global Components</h3>
    <p>App.vue</p>
    <p>The CompOne.vue component is used inside both App.vue and CompTwo.vue.</p>
    <comp-one /> <br>
    <comp-two />
  </div>
</template>

<script></script>

<style>
  p {
    width: 200px;
  }
  #app div {
    border: dashed black 1px;
    margin: 10px;
    padding: 10px;
    display: inline-block;
  }
  .compOneDiv {
    background-color: lightgreen;
  }
  .compTwoDiv {
    background-color: lightcoral;
  }
</style>                  
<template>
    <div class="compOneDiv">
        <p>CompOne.vue</p>
    </div>
</template>

<script></script>

<style></style>                  
<template>
    <div class="compTwoDiv">
        <p>CompTwo.vue</p>
        <comp-one />
    </div>
</template>

<script></script>

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

import App from './App.vue'
import CompOne from './components/CompOne.vue'
import CompTwo from './components/CompTwo.vue'

const app = createApp(App)
app.component('comp-one', CompOne)
app.component('comp-two', CompTwo)
app.mount('#app')
                  
http://localhost:5173/