I'm attempting to utilize the ButtonCounter component as a demonstration (source: https://vuejs.org/guide/essentials/component-basics.html#defining-a-component), but I am facing difficulties in getting it to function properly. I am utilizing Vue.js 3 from a CDN.
Here is the content of my ButtonCounter.js file:
export default {
data() {
return {
count: 0
}
},
template: `
<button @click="count++">
You have clicked me {{ count }} times.
</button>`
}
Next, I have the main JavaScript file with Vue:
import ButtonCounter from './ButtonCounter.js'
const app = Vue.createApp({
components: {
ButtonCounter
},
data() {
return {
aaa: []
}
},
methods: {
...
}
}
})
app.mount('#app')
Lastly, within the HTML document where I link Vue.js from the CDN, and specify the following inside the body:
<ButtonCounter />
Despite following these steps, I am unable to see the button. Could someone please advise me on what I might be doing wrong?