Skip to content

Instantly share code, notes, and snippets.

@tsukiyama-a5
Created November 16, 2019 09:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tsukiyama-a5/b501cbdce906e876666c59bb9bf6260b to your computer and use it in GitHub Desktop.
Save tsukiyama-a5/b501cbdce906e876666c59bb9bf6260b to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
</head>
<body>
<div id="app">
{{name}}:{{age}}歳<br>
<button v-on:click='plus'>足す</button>
<button v-on:click='minus'>引く</button>
</div>
<script src="https://jp.vuejs.org/js/vue.js"></script>
<script>
var app = new Vue({
el: '#app',
data: {
name: 'ogura',
age: 53
},
methods: {
plus: function() {
console.log(1);
this.age = this.age + 1;
},
minus: function() {
console.log(-1);
this.age = this.age - 1;
}
}
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment