App.vue
ChildComp.vue
main.js
<template>
<h2>Example Built-in 'is' Attribute</h2>
<p>The IMG tag below is set to be replaced by a component by the use of 'is="vue:child-comp"'.</p>
<img is="vue:child-comp" />
</template>
<template>
<div>
<h3>ChildComp.vue</h3>
<p>This is the child component</p>
</div>
</template>
<style scoped>
div {
border: solid black 1px;
background-color: lightgreen;
padding: 10px;
max-width: 250px;
margin-top: 20px;
}
</style>
import { createApp } from 'vue'
import App from './App.vue'
import ChildComp from './components/ChildComp.vue'
const app = createApp(App)
app.component('child-comp', ChildComp)
app.mount('#app')