コード例 #1
0
ファイル: index.js プロジェクト: Kocher-JGC/learn
Vue.prototype.$mount = function (
  el?: string | Element,
  hydrating?: boolean
): Component {
  el = el && inBrowser ? query(el) : undefined
  return mountComponent(this, el, hydrating) // $mount真正调用的方法
}
コード例 #2
0
ファイル: index.js プロジェクト: Fishesssss/vuido
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;
};