Search code examples
componentsvue.js

Vue.js about passing data with props


enter image description here

enter image description here

enter image description here

I start to learn Vue.js. About passing data to chlid-component, I met a mess. The data isn't shown on the child-component. Why? Somewhere mistake?


Solution

  • As explained here, HTML attributes are case-insensitive, so when using non-string templates, camelCased prop names need to use their kebab-case (hyphen-delimited) equivalents like following:

    <child v-bind:child-msg="parentMsg"></child>