Vue.prototype.$mount = function ( el?: string | Element, hydrating?: boolean ): Component { el = el && inBrowser ? query(el) : undefined return mountComponent(this, el, hydrating) // $mount真正调用的方法 }
Vue.prototype.$mount = function( el, hydrating ) { if ( el != null ) throw new Error( 'Mount element is not supported' ); mountComponent( this, el, hydrating ); if ( this.$parent == null && this.$el.widget == null ) { if ( this.$el.tagName != 'Window' ) throw new Error( 'Top level element must be a Window' ); this.$el._mountWindow(); this.$on( 'hook:destroyed', () => { this.$el._destroyWindow(); } ); } return this; };