Dispatch Input Event to VM

by ktsn

HTML

<script src="https://rawgit.com/yyx990803/vue/master/dist/vue.js"></script>

JavaScript

var vm = new Vue({
  template: "<div><h1>{{msg}}</h1><input v-model='msg'></div>",
  data: function () {
    return {
      msg: 'Hello World'
    }
  }
}).$mount('body')

var input = vm.$el.querySelector('input')
input.value = "the earth says hello"

var event = new Event('input');
input.dispatchEvent(event);

console.log('This is the message:', vm.msg)