Skip to content

Instantly share code, notes, and snippets.

@ghhv
Forked from dengjonathan/Vue.html
Created January 6, 2017 12:09
Show Gist options
  • Save ghhv/8bece5bff1e37bda24910294e9c132d6 to your computer and use it in GitHub Desktop.
Save ghhv/8bece5bff1e37bda24910294e9c132d6 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