JSFiddle - React, Tailwind, and code Playground
by teewelk
HTML
<script src="https://unpkg.com/vue/dist/vue.js"></script>
<div id="app">
<h1 ref="heading">{{ title }}</h1>
<button v-on:click="show">Show Paragraph</button>
<p v-if="showParagraph">This is not always visible</p>
</div>
<div id="app2">
<h1>
{{title}}
<button @click="onChange">change something in Vue 1
</button>
</h1>
</div>
JavaScript
new Vue({
el: '#app',
data: {
title: 'The VueJS Instance',
showParagraph: false
},
methods: {
show: function() {
this.showParagraph = true;
this.updateTitle('The VueJS Instance (Updated)');
},
updateTitle: function(title) {
this.title = title;
}
},
computed: {
lowercaseTitle: function() {
return this.title.toLowerCase();
}
},
watch: {
title: function(value) {
alert('Title changed, new value: ' + value);
}
}
});