Vue props example
Using pro
HTML
<div id="components-demo">
<child-form>
</child-form>
</div>
Vue
// Define a new component called button-counter
Vue.component('child-form', {
props: {
outerValue: String
},
data: function () {
return {
value: outerValue
}
},
template: '<form><input type="text" v-model="value"/></form>'
})
Vue.component('hash-counter', {
props: ['counter'],
data: function () {
return {
parentValue: 'a'
}
},
template: '<child-form :outer-value="2"></child-form>'
})
new Vue({ el: '#components-demo' })