Skip to content

Instantly share code, notes, and snippets.

@PKTseng
Last active August 4, 2020 01:11
Show Gist options
  • Save PKTseng/f8742278390300ea156602b4d013969d to your computer and use it in GitHub Desktop.
Save PKTseng/f8742278390300ea156602b4d013969d to your computer and use it in GitHub Desktop.
computed & watch 比較
<div id="app">
 <input v-model="a">+
 <input v-model="b">=
 <input v-model="c">
</div>
new Vue({
 el:"#app",
 data:{
a: 0,
b: 0,
 },
 computed:{
c(){
return parseInt(this.a, 10) + parseInt(this.b, 10) ;
},
 },
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment