<div id="app">
  Type the first number:
  <input type="number" v-model.number="n1"><br />
  Type the second number:
  <input type="number" v-model.number="n2"><br />
  The sum() is: {{ sum() }}<br />
  The sum2 is: {{ sum2 }}<br />
</div>
var app = new Vue({
  el: "#app",
  data: {
    n1: 0,
    n2: 0,
    sum2: 0
  },
  methods: {
    sum: function () {
      return this.n1 + this.n2;
    }
  },
  watch: {
    n1: function(value) {
      this.sum2 = this.n2 + value
    },
    n2: function(value) {
      this.sum2 = this.n1 + value
    }
  }
});

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

  1. https://cdn.jsdelivr.net/npm/vue/dist/vue.js