- constructor (
- tag?: string,
- data?: VNodeData,
- children?: ?Array<VNode>,
- text?: string,
- elm?: Node,
- context?: Component,
- componentOptions?: VNodeComponentOptions
- ) {
- / 当前节点的标签名 /
- this.tag = tag
- / 当前节点对应的对象, 包含了具体的一些数据信息, 是一个 VNodeData 类型, 可以参考 VNodeData 类型中的数据信息 /
- this.data = data
- / 当前节点的子节点, 是一个数组 /
- this.children = children
- / 当前节点的文本 /
- this.text = text
- / 当前虚拟节点对应的真实 dom 节点 /
- this.elm = elm
- / 当前节点的名字空间 /
- this.ns = undefined
- / 编译作用域 /
- this.context = context
- / 函数化组件作用域 /
- this.functionalContext = undefined
- / 节点的 key 属性, 被当作节点的标志, 用以优化 /
- this.key = data && data.key
- / 组件的 option 选项 /
- this.componentOptions = componentOptions
- / 当前节点对应的组件的实例 /
- this.componentInstance = undefined
- / 当前节点的父节点 /
- this.parent = undefined
- / 简而言之就是是否为原生 html 或只是普通文本, innerHTML 的时候为 true,textContent 的时候为 false/
- this.raw = false
- / 静态节点标志 /
- this.isStatic = false
- / 是否作为跟节点插入 /
- this.isRootInsert = true
- / 是否为注释节点 /
- this.isComment = false
- / 是否为克隆节点 /
- this.isCloned = false
- / 是否有 v-once 指令 /
- this.isOnce = false
- }
来源: http://www.qdfuns.com/article/51116/d7c9d80e3ea275cb175784cec6557c12.html