<div id="demo"> <input type="text" v-model="name"> <button v-on:click="alertName">Say My Name</button> <br> <!-- This stringifies the contents of the data object and displays it on the page --> <pre>{{ $data }}</pre> </div>
new Vue({ el: "#demo", data: { name: "Ayo Isaiah" }, methods: { alertName: function() { alert("Your name is " + this.name); } } });