[FIX] components: make sure t-ref work with t-if/t-else

This commit is contained in:
Géry Debongnie
2021-12-22 08:52:51 +01:00
committed by Samuel Degueldre
parent 34b781aeed
commit 489e20843c
9 changed files with 160 additions and 33 deletions
+2 -1
View File
@@ -12,9 +12,10 @@ import { onMounted, onPatched, onWillUnmount } from "./component/lifecycle_hooks
*/
export function useRef<T extends HTMLElement = HTMLElement>(name: string): { el: T | null } {
const node = getCurrent()!;
const refs = node.refs;
return {
get el(): T | null {
return node.refs[name] || null;
return refs[name] || null;
},
};
}