JSFiddle - React, Tailwind, and code Playground
by mbudnik
HTML
<script src="https://unpkg.com/[email protected]/dist/vue.js"></script>
<div id="app">
<button v-on:click="increase">Increase</button>
<button v-on:click="decrease">Decrease</button>
<p>{{ counter }}</p>
<p>{{ result }}</p>
</div>
JavaScript
new Vue({
el: '#app',
data: {
result: '',
counter: 0
},
methods: {
increase: function() {
this.counter++;
this.result = this.counter > 5 ? 'Greater 5' : 'Smaller 5';
},
decrease: function() {
this.counter--;
this.result = this.counter > 5 ? 'Greater 5' : 'Smaller 5';
}
}
})