const localComponent1={
data(){
return {
text: 'localComponent1'
}
},
template: `
<div class="alert alert-primary" role="alert">
{{ text }}
</div>
`
}
const localComponent2={
data(){
return {
text: 'localComponent2'
}
},
template: `<div class="alert alert-primary" role="alert">
{{ text }}
</div>`
}
const app = Vue.createApp({
data() {
return {
text: '根元件 的 text',
};
},
})
// 不要使用大寫名稱
app.component('localtest',localComponent1);
// 如果一定要使用的話,在html中記得轉換為<local-component2></local-component2>
app.component('localComponent2',localComponent2);
app.mount('#app');