JSFiddle - React, Tailwind, and code Playground
by Bo Andersen
HTML
<script src="https://unpkg.com/vue/dist/vue.js"></script>
<div id="vm1">
<h1>{{ name }}</h1>
</div>
<div id="vm2">
<button @click="showName">Show name</button>
</div>
JavaScript
var vm1 = new Vue({
el: '#vm1',
data: {
name: 'Vue Instance #1'
}
});
var vm2 = new Vue({
el: '#vm2',
methods: {
showName: function() {
alert("The name of the other Vue instance is: " + vm1.name);
}
}
});
setTimeout(function() {
vm1.name = 'Hello from the other side!';
}, 2000);