Supporting the ref-prop
This commit is contained in:
parent
f3597cbbb1
commit
029fe16b6d
@ -68,6 +68,10 @@ export function render(vnode, opts = {}) {
|
|||||||
if (!item.host) {
|
if (!item.host) {
|
||||||
item.host = renderer.create(item);
|
item.host = renderer.create(item);
|
||||||
newlyCreated = true;
|
newlyCreated = true;
|
||||||
|
|
||||||
|
if(item.vnode?.props?.ref){// If props specify a ref-function, queue it to be called at the end of the render
|
||||||
|
state.refs.push([item.vnode.props.ref,item.host]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update the element
|
// Update the element
|
||||||
@ -231,5 +235,9 @@ export function render(vnode, opts = {}) {
|
|||||||
if(!item.parent) newRoot = item.host;
|
if(!item.parent) newRoot = item.host;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for(let [refCb, refItem] of state.refs){
|
||||||
|
refCb(refItem);
|
||||||
|
}
|
||||||
return newRoot;
|
return newRoot;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -10,6 +10,7 @@ const VNODEPROP_EXCLUDE_DIRECT = {
|
|||||||
};
|
};
|
||||||
const VNODEPROP_IGNORE = {
|
const VNODEPROP_IGNORE = {
|
||||||
['key']: true,
|
['key']: true,
|
||||||
|
['ref']: true
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user