I created 2 Vue components:
Vue.component('vimeo', {
template: '<iframe src="https://player.vimeo.com/video/' + this.videoId + '" width="640" height="360" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>',
props: ['videoId']
});
Vue.component('videos', {
template: '<div id="videos">' +
'<div v-for="videoId in videoIds">' +
'<vimeo :video-id="videoId"></vimeo>' +
'</div>' +
'</div>',
computed: {
videoIds: function() {
return store.state.videoIds;
}
}
});
However, the this.videoId is always undefined in the 'vimeo' component template. If I change the template to:
<h1>{{ videoId }}</h1>
the prop value can be displayed properly.
I have searched the internet for solutions to this, but unfortunately, I have not got any.