v-model and computed example

by Lloyd Atkinson

HTML

<div id="app">
  <label for="old">Old</label>
  <input name="old" type="text" v-model="oldEmail">
  
  <label for="old">New</label>
  <input name="old" type="text" v-model="newEmail">
  
  <p v-if="emailsMatch">
    Old and new should not match!
  </p>
</div>

Vue

new Vue({
  el: "#app",
  data: {
    oldEmail: '',
    newEmail: '',
  },
  computed: {
  	emailsMatch: function () {
    	return this.oldEmail === this.newEmail;
    }
  }
})