wip: add types to refactored runtime-core

This commit is contained in:
Evan You
2019-05-26 15:19:44 +08:00
parent 3cded86b98
commit b3f8b5ae0a
9 changed files with 269 additions and 135 deletions

View File

@@ -1,18 +1,12 @@
import { VNode, ChildrenFlags } from '@vue/runtime-core'
export function patchDOMProp(
el: any,
key: string,
value: any,
prevVNode: VNode,
prevChildren: any,
unmountChildren: any
) {
if (key === 'innerHTML' || key === 'textContent') {
if (prevVNode && prevVNode.children) {
unmountChildren(prevVNode.children, prevVNode.childFlags)
prevVNode.children = null
prevVNode.childFlags = ChildrenFlags.NO_CHILDREN
}
if ((key === 'innerHTML' || key === 'textContent') && prevChildren != null) {
unmountChildren(prevChildren)
}
el[key] = value
}

View File

@@ -1,6 +1,6 @@
import { isString } from '@vue/shared'
export function patchStyle(el: any, prev: any, next: any, data: any) {
export function patchStyle(el: any, prev: any, next: any) {
const { style } = el
if (!next) {
el.removeAttribute('style')