Skip to content

Instantly share code, notes, and snippets.

@andr-ec
Created June 9, 2019 20:24
Show Gist options
  • Save andr-ec/287a184ae9da01202f4d91b0ce3dd82f to your computer and use it in GitHub Desktop.
Save andr-ec/287a184ae9da01202f4d91b0ce3dd82f to your computer and use it in GitHub Desktop.
Vue.js Counter
<template>
<div id="app">
<p>{{counter}}</p>
<button @click="onAdd">add</button>
<button @click="onMinus">minus</button>
</div>
</template>
<script>
// import HelloWorld from './components/HelloWorld.vue'
export default {
name: 'app',
data: () => ({
counter: 0
}),
methods: {
onAdd() {
this.counter += 1
},
onMinus() {
this.counter -= 1
}
},
components: {
// HelloWorld
}
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment