types: improve ref typing (#8124)

* types: improve ref typing

* types: message
This commit is contained in:
neverland
2021-02-10 20:57:24 +08:00
committed by GitHub
parent 3e08b2471a
commit 0b68d3a141
8 changed files with 10 additions and 10 deletions
+2 -2
View File
@@ -1,8 +1,8 @@
import { useRect } from '@vant/use';
import { Ref, ref, onMounted, nextTick } from 'vue';
export const useHeight = (element: Element | Ref<Element>) => {
const height = ref();
export const useHeight = (element: Element | Ref<Element | undefined>) => {
const height = ref<number>();
onMounted(() => {
nextTick(() => {
+1 -1
View File
@@ -2,7 +2,7 @@ import { useHeight } from './use-height';
import type { Ref } from 'vue';
import type { BEM } from '../utils/create/bem';
export function usePlaceholder(contentRef: Ref<Element>, bem: BEM) {
export function usePlaceholder(contentRef: Ref<Element | undefined>, bem: BEM) {
const height = useHeight(contentRef);
return (renderContent: () => JSX.Element) => (