I have a code like below. 5 first componets are rendered correctly, but next 3 are not. Only first one from those 3 is rendered:
const test = {
data() {
return {
count: 0
};
},
props: {
text: {
type: Number,
required: true
}
},
template: `
<button @click="count++">
[ {{text}} ] You clicked me {{ count }} times.
</button>
`
};
const app = Vue.createApp({});
app.component("test", test);
app.mount("#app");
<!DOCTYPE html>
<html>
<body>
<div id="app">
<div v-for="i in 5">
<test :text="i" />
</div>
<hr />
<test :text="99" />
<test :text="42" />
<test :text="55" />
</div>
<script
id="vue"
src="https://unpkg.com/vue@3.0.11/dist/vue.global.prod.js"
></script>
</body>
</html>
Obviously... I want to be able to use components not only in the loops. What I missed?
BTW, this same behavior I was able to reproduce with latest vue 2.x (with slightly different vue app initialization code, ofc)