Created
July 20, 2017 21:37
-
-
Save rdegges/859b9a3b2669b6995c5c18c0e5e06e0a to your computer and use it in GitHub Desktop.
Vue method example.
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
<html> | |
<body> | |
<div id="app"> | |
<p>What's your favorite color?</p> | |
<input v-model="color" type="text"> | |
<p>Your favorite color is... {{ color }}</p> | |
<input type="button" v-on:click="capitalizeColor" value="Capitalize"> | |
</div> | |
<script src="https://unpkg.com/vue"></script> | |
<script> | |
let app = new Vue({ | |
el: "#app", | |
data: { | |
color: '' | |
}, | |
methods: { | |
capitalizeColor: function() { | |
this.color = this.color.toUpperCase(); | |
} | |
} | |
}); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment