1. 初始化 $vnode、$slots、$scopedSlots
    2. 初始化 _c,$createElement 两个创建 虚拟DOM 的函数,前者用于模板编译,后者用于暴露给用户
    3. 初始化 $attrs 和 $listeners,并使其具备响应式,在非生产中,在设置这两个值的时候会有非法提示 ```javascript export function initRender (vm: Component) { // 初始化 $vnode、$slots、scopedSlots

      vm._vnode = null // the root of the child tree vm._staticTrees = null // v-once cached trees const options = vm.$options const parentVnode = vm.$vnode = options._parentVnode // the placeholder node in parent tree const renderContext = parentVnode && parentVnode.context vm.$slots = resolveSlots(options._renderChildren, renderContext) vm.$scopedSlots = emptyObject

    // _c 和 $createElement 都是用于生成虚拟 DOM 的 // 前者用于模板生成,后者则是暴露给开发者的 // 两者的差异主要体现在最后一个参数,最后一个参数是用于判断 //TODO

    // bind the createElement fn to this instance // so that we get proper render context inside it. // args order: tag, data, children, normalizationType, alwaysNormalize // internal version is used by render functions compiled from templates vm._c = (a, b, c, d) => createElement(vm, a, b, c, d, false) // normalization is always applied for the public version, used in // user-written render functions. vm.$createElement = (a, b, c, d) => createElement(vm, a, b, c, d, true)

    // $attrs & $listeners are exposed for easier HOC creation. // they need to be reactive so that HOCs using them are always updated const parentData = parentVnode && parentVnode.data

    // 初始化 $attrs 和 $listeners,并使其具备响应式,在非生产中,在设置这两个值的时候会有非法提示 / istanbul ignore else / if (process.env.NODE_ENV !== ‘production’) { defineReactive(vm, ‘$attrs’, parentData && parentData.attrs || emptyObject, () => { !isUpdatingChildComponent && warn($attrs is readonly., vm) }, true) defineReactive(vm, ‘$listeners’, options._parentListeners || emptyObject, () => { !isUpdatingChildComponent && warn($listeners is readonly., vm) }, true) } else { defineReactive(vm, ‘$attrs’, parentData && parentData.attrs || emptyObject, null, true) defineReactive(vm, ‘$listeners’, options._parentListeners || emptyObject, null, true) } } ```