Created
June 9, 2019 20:24
-
-
Save andr-ec/287a184ae9da01202f4d91b0ce3dd82f to your computer and use it in GitHub Desktop.
Vue.js Counter
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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