Binding Props in VueJs Components
Passing data to VueJs components by binding data to props - http://coligo.io
by Edward Tanguay
HTML
<script src="https://cdn.jsdelivr.net/vue/1.0.16/vue.js"></script>
<div id="app">
<post :title="mainTitle" :author="mainAuthor" :content="mainContent"></post>
</div>
<template id="post-template">
<h4>{{ title }}</h4>
<h4>{{ author }}</h4>
<p>{{ content }}</p>
</template>
JavaScript
Vue.component('post', {
template: '#post-template',
props: ['title', 'author', 'content']
});
var vm = new Vue({
el: '#app',
data: {
mainAuthor: 'Jim2',
mainTitle: 'Test Title',
mainContent: 'A longer text here'
}
});