(
Ctor, //VueComponen函数
data, // 组件标签上面的属性数据
context, //vm Vue 实例化之后的对象上下文
children, //子节点
tag)
| 6079 | |
| 6080 | //创建组件 |
| 6081 | function createComponent( |
| 6082 | Ctor, //VueComponen函数 |
| 6083 | data, // 组件标签上面的属性数据 |
| 6084 | context, //vm Vue 实例化之后的对象上下文 |
| 6085 | children, //子节点 |
| 6086 | tag) { //标签 |
| 6087 | |
| 6088 | |
| 6089 | |
| 6090 | if (isUndef(Ctor)) { |
| 6091 | return |
| 6092 | } |
| 6093 | //vue |
| 6094 | //用来标识扩展所有普通对象的“基”构造函数 |
| 6095 | // Weex的多实例场景中的组件。 |
| 6096 | var baseCtor = context.$options._base; //基本的Vue 静态类 |
| 6097 | |
| 6098 | // plain options object: turn it into a constructor |
| 6099 | //普通选项对象:将其转换为构造函数 _base vue 的 构造函数 |
| 6100 | if (isObject(Ctor)) { |
| 6101 | Ctor = baseCtor.extend(Ctor); |
| 6102 | } |
| 6103 | |
| 6104 | // if at this stage it's not a constructor or an async component factory, |
| 6105 | //如果在这个阶段它不是构造函数或异步组件工厂, |
| 6106 | // reject. |
| 6107 | if (typeof Ctor !== 'function') { //如果不是函数则发出警告 |
| 6108 | { |
| 6109 | warn(("Invalid Component definition: " + (String(Ctor))), context); |
| 6110 | } |
| 6111 | return |
| 6112 | } |
| 6113 | console.log(Ctor) |
| 6114 | console.log(baseCtor) |
| 6115 | console.log(context) |
| 6116 | |
| 6117 | |
| 6118 | // async component |
| 6119 | //异步组件 |
| 6120 | var asyncFactory; |
| 6121 | // Vue.cid = 0; |
| 6122 | |
| 6123 | |
| 6124 | if (isUndef(Ctor.cid)) { //组件的id 唯一标识符 |
| 6125 | |
| 6126 | asyncFactory = Ctor; // |
| 6127 | // 解决异步组件 更新组建数据 |
| 6128 | Ctor = resolveAsyncComponent( //返回组件现在的状态 |
| 6129 | asyncFactory, //新的 |
| 6130 | baseCtor, //基本的Vue 静态类 |
| 6131 | context //当前已经实例化的vm对象 |
| 6132 | ); |
| 6133 | |
| 6134 | if (Ctor === undefined) { |
| 6135 | // return a placeholder node for async component, which is rendered |
| 6136 | // as a comment node but preserves all the raw information for the node. |
| 6137 | // the information will be used for async server-rendering and hydration. |
| 6138 |
no test coverage detected