-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add small dom utility to resolve the dom node from a ref * use dom() to resolve underlying DOM node There is probably a better way to do this, the idea is that we apply a ref to the component. However by default for html components `yourRef.value` will be the underlying DOM node. However if you pass the ref to another component, the actual DOM node will be located at `yourRef.value.$el`. Fixes: #21 * update changelog
- Loading branch information
1 parent
c4549e4
commit 2505c5f
Showing
6 changed files
with
87 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { Ref } from 'vue' | ||
|
||
export function dom<T extends HTMLElement>(ref?: Ref<T | null>): T | null { | ||
if (ref == null) return null | ||
if (ref.value == null) return null | ||
return ((ref as Ref<T & { $el: unknown }>).value.$el ?? ref.value) as T | null | ||
} |