The very first Vue.js example

by rigor789

HTML

<script src="https://unpkg.com/[email protected]"></script>
<div id="demo">
  <test></test>
</div>

<pre>
  0 - oldVnode
  1 - vnode
  2 - hydrating
  3 - removeOnly
  4 - parentElm
  5 - refElm
</pre>

JavaScript

Vue.config.silent = true

setTimeout(() => {
  let patchId = 0;
  let patch = Vue.prototype.__patch__
  Vue.prototype.__patch__ = function() {
    console.log(patchId++, arguments)
    return patch.call(this, ...arguments)
  }
  
  let mount = Vue.prototype.$mount
  Vue.prototype.$mount = function() {
    console.log('mount', arguments)
    return mount.call(this, ...arguments)
  }
  new Vue({
    components: {
      test: {
        name: 'test',
        template: '<span>yo</span>'
      }
    }
  }).$mount('#demo')
})