Closed
Description
1 . define a custom hook useClickOutside and recive a argument elementRef ,the elementRef type is Ref<null | HTMLElement>
2. define a dropdownRef type is null or HTMLElement
3. template has a div set ref attribute dropdownRef
Result :
Here I think there may be a problem with the implementation of volar. It will directly expand the HTMLElement type, causing a mismatch of types.
//template <div class="dropdown" ref="dropdownRef">
// custom hook
const useClickOutside = (elementRef: Ref<null | HTMLElement>): Ref<boolean> => {
//some other code
}
const dropdownRef = ref<null | HTMLElement>(null)
const isClickOutside = useClickOutside(dropdownRef) // causing a mismatch of types.