Binding Props in VueJs Components
Passing data to VueJs components by binding data to props - http://coligo.io
by Syed Hussain
HTML
<script src="https://cdn.jsdelivr.net/vue/1.0.16/vue.js"></script>
<div id="app">
<post :title="title" :author="author" :content="content"></post>
</div>
<template id="post-template">
<h1>{{ title }}</h1>
<h4>{{ author }}</h4>
<p>{{ content }}</p>
</template>
JavaScript
let store = {
_author: 'Johnnie Walker',
};
Vue.component('post', {
template: '#post-template',
props: ['title', 'author', 'content']
});
var vm = new Vue({
el: '#app',
data: {
author: store,
title: 'Aging Your Own Whisky',
content: 'A bunch of steps and a whole lot of content'
}
});