JSFiddle - React, Tailwind, and code Playground
by cheongjin kim
HTML
<script src="https://unpkg.com/[email protected]/dist/vue.js"></script>
<template id="child">
<div>
{{ t }}
</div>
</template>
<div id="app">
<child :context="this" :t="text"></child>
</div>
JavaScript
Vue.component('child', {
template: '#child',
props: ['context', 't'],
mounted () {
let vm = this
setTimeout(function() {
vm.context.text = 'changed!'
}, 2000)
}
});
new Vue({
el: '#app',
data() {
return {
text: 'hello'
}
}
});