
vue
lt3487928
这个作者很懒,什么都没留下…
展开
-
vue 源码学习系列 一 - vue构建
最近在学习vue的源码,顺便在博客中记录一下学习历程。首先安装vue-cli和vue,这里不多做介绍。安装完成后vue目录如下: vue是通过rollup构建的,构建同时选择flow作为js类型检测工具,这里不多做介绍。打开工程根目录下面的package.json 里面部分内容如下:红框框内的3句命令分别构建web版本,服务端版本和weex版本vue这里我们只分析w...原创 2018-08-10 12:02:16 · 496 阅读 · 0 评论 -
vue 源码学习系列 二- vue构造函数1
上篇我们找到vue的入口文件:src/platforms/web/entry-runtime-with-compiler.js源码如下:/* @flow */import config from 'core/config'import { warn, cached } from 'core/util/index'import { mark, measure } from 'cor...原创 2018-08-10 18:05:42 · 675 阅读 · 0 评论 -
vue 源码学习系列 二 - vue构造函数2
vue构造函数源码如下:function Vue (options) { if (process.env.NODE_ENV !== 'production' && !(this instanceof Vue) ) { warn('Vue is a constructor and should be called with the `new` keywo...原创 2018-08-10 18:03:20 · 313 阅读 · 0 评论 -
vue 源码学习系列 三- vue $mount 1
上一节在vue构造函数中有一句调用:vm.$mount(vm.$options.el),我来来看一下vue是如何把dom节点挂载上去的。打开 src/platforms/web/entry-runtime-with-compiler.js: /* @flow */import config from 'core/config'import { warn, cached } fr...原创 2018-08-13 10:57:29 · 275 阅读 · 0 评论 -
vue 源码学习系列 三- vue $mount 2
上一节我们介绍到调用mountComponent方法。我们来看一下他的庐山真容。打开src/core/instance/lifecycle.js:export function mountComponent ( vm: Component, el: ?Element, hydrating?: boolean): Component { vm.$el = el if ...原创 2018-08-13 14:25:27 · 303 阅读 · 0 评论 -
vue 源码学习系列 四- vue _render
上节我们分析到mountComponent函数中:vm._update(vm._render(), hydrating)这句,其中vm._render()是创建vNode我们一起看一下源码,vue的render函数在src/core/instance/render.js中声明代码如下:Vue.prototype._render = function (): VNode { co...原创 2018-08-15 14:36:38 · 283 阅读 · 0 评论