[Vuejs]-Component props are undefined in Vue.js

0👍

See camelCase vs. kebab-case:

HTML attributes are case-insensitive, so […] camelCased prop names need to use their kebab-case (hyphen-delimited) equivalents:

Vue.component('child', {
  // camelCase in JavaScript
  props: ['myMessage'],
  template: '<span>{{ myMessage }}</span>'
})


<!-- kebab-case in HTML -->
<child my-message="hello!"></child>

Thus you need to bind your component property as follows:

<component-name :id-video="someVar"></component-name>
👤str

0👍

To pass the information from the parent to the child I used an update this is the code:

export default {
  updated(){
    this.getRelVideos()
  },
  methods: {
    getRelVideos: function() {}
  }
}

in that way in the console it show the request.

Leave a comment