Vue中我们是通过Vue实例挂载的实现 - 图1mount方法在多个文件中都有定义,如

文件路径

  1. $mount
  2. src/platform/web/entry-runtime-with-compiler.js
  3. src/platform/web/runtime/index.js
  4. mountComponent
  5. src/core/instance/lifecycle.js

总结

跟着大神的脚步去探险,核心方法:

  1. vm._render()
  2. vm._update()