<div id="app">
<div>
<p>Counter: {{ counter }}</p>
</div>
<button @click="addCounterFunction">Add Counter (Function)</button>
<button @click="addCounterArrowFunction">Add Counter (Arrow Function)</button>
</div>
<script src="https://cdn.jsdelivr.net/npm/vue@2.5.13/dist/vue.js"></script>
var app = new Vue({
el: '#app',
data: {
counter: 0
},
methods: {
addCounterFunction: function() {
this.counter++
},
addCounterArrowFunction: () => {
this.counter++
},
}
})
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.