Last active
August 4, 2020 01:11
-
-
Save PKTseng/f8742278390300ea156602b4d013969d to your computer and use it in GitHub Desktop.
computed & watch 比較
This file contains 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="app"> | |
<input v-model="a">+ | |
<input v-model="b">= | |
<input v-model="c"> | |
</div> |
This file contains 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
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