I've got a custom Vue component that is successfully bound to a javascript object, but now would like to re-bind the component to another object. Is this possible?
Markup:
<div id="wrapper">
<p v-component="user-profile" v-with="user"></p>
</div>
With the following component / vue:
Vue.component('user-profile', {
template: '{{name}}<br>{{email}}'
})
var parent = new Vue({
el: '#wrapper',
data: {
user: {
name: 'Foo Bar',
email: '[email protected]'
}
}
})
I'd like to re-bind the component with the following data:
user: {
name: 'Baz',
email: '[email protected]'
}