JSFiddle - React, Tailwind, and code Playground
HTML
<script src="https://unpkg.com/[email protected]/dist/vue.js"></script>
<div id="app">
<my-component :user="my_prop"></my-component>
</div>
JavaScript
var my_prop = {
firstname: 'Jack',
lastname: 'Bauer'
};
Vue.component('my-component', {
props: ['user'],
template: '<p>{{ user }}</p>'
});
var app = new Vue({
el: '#app',
data: {'my_prop': false},
created: function() {
if (typeof(my_prop) != "undefined") {
this.my_prop = my_prop;
}
}
});
app.my_prop: 'test' ;