Let's say I have a basic page with VueJS as follows:
Vue.component('child', {
template: '<p>{{message}}</p>',
props: ["message"]
});
new Vue({
el: '#theParent',
data() {
return {
message: "It works!"
}
}
});
<script src="https://cdn.jsdelivr.net/vue/2.3.2/vue.min.js"></script>
<div id="theParent">
<child v-bind:message="message"></child>
<child v-bind:message="message"></child>
<child v-bind:message="message"></child>
</div>
The message It works! shows up three times as expected, but if I remove v-bind:message="message" on my <child> components it doesn't work. As all my <child> components will require the value of message from the parent, is there a way to specify this once in the VueJS component declaration rather than each time in the HTML when adding a <child>?
<child>components it's a real hassle to keep specifying it each time...v-for<child>components so they are unique).