Skip to content

Instantly share code, notes, and snippets.

@dengjonathan
Created December 9, 2016 23:54
Show Gist options
  • Save dengjonathan/f253b937942e8e4c37051109d49451df to your computer and use it in GitHub Desktop.
Save dengjonathan/f253b937942e8e4c37051109d49451df to your computer and use it in GitHub Desktop.
Vue example by reader @thoragio
<div id="counter">
<button @click="up()">+</button>
<p id="count">{{ value }}</p>
<button @click="down()">-</button>
</div>
<script>
var counter = new Vue({
el: '#counter',
data: {
value: 0
},
methods: {
up: function() {
this.value += 1
},
down: function() {
this.value -= 1
}
}
})
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment