-
-
Save ghhv/8bece5bff1e37bda24910294e9c132d6 to your computer and use it in GitHub Desktop.
Vue example by reader @thoragio
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
<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