feat: template ref handling + ref unmount
This commit is contained in:
@@ -3,10 +3,11 @@ export function patchDOMProp(
|
||||
key: string,
|
||||
value: any,
|
||||
prevChildren: any,
|
||||
parentComponent: any,
|
||||
unmountChildren: any
|
||||
) {
|
||||
if ((key === 'innerHTML' || key === 'textContent') && prevChildren != null) {
|
||||
unmountChildren(prevChildren)
|
||||
unmountChildren(prevChildren, parentComponent)
|
||||
}
|
||||
el[key] = value
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ export function patchProp(
|
||||
prevValue: any,
|
||||
isSVG: boolean,
|
||||
prevChildren?: VNode[],
|
||||
parentComponent?: any,
|
||||
unmountChildren?: any
|
||||
) {
|
||||
switch (key) {
|
||||
@@ -27,7 +28,14 @@ export function patchProp(
|
||||
if (isOn(key)) {
|
||||
patchEvent(el, key.slice(2).toLowerCase(), prevValue, nextValue)
|
||||
} else if (!isSVG && key in el) {
|
||||
patchDOMProp(el, key, nextValue, prevChildren, unmountChildren)
|
||||
patchDOMProp(
|
||||
el,
|
||||
key,
|
||||
nextValue,
|
||||
prevChildren,
|
||||
parentComponent,
|
||||
unmountChildren
|
||||
)
|
||||
} else {
|
||||
patchAttr(el, key, nextValue, isSVG)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user