From 63f15094f33d0a1784c74d9ced449ec479459dff Mon Sep 17 00:00:00 2001 From: chenjiahan Date: Mon, 21 Sep 2020 18:48:11 +0800 Subject: [PATCH] types: use-placeholder --- src/composition/use-placeholder.js | 14 -------------- src/composition/use-placeholder.tsx | 16 ++++++++++++++++ 2 files changed, 16 insertions(+), 14 deletions(-) delete mode 100644 src/composition/use-placeholder.js create mode 100644 src/composition/use-placeholder.tsx diff --git a/src/composition/use-placeholder.js b/src/composition/use-placeholder.js deleted file mode 100644 index fdff8caa5..000000000 --- a/src/composition/use-placeholder.js +++ /dev/null @@ -1,14 +0,0 @@ -import { useHeight } from './use-rect'; - -export function usePlaceholder(contentRef, bem) { - const height = useHeight(contentRef); - - return (renderContent) => ( -
- {renderContent()} -
- ); -} diff --git a/src/composition/use-placeholder.tsx b/src/composition/use-placeholder.tsx new file mode 100644 index 000000000..02e5727e6 --- /dev/null +++ b/src/composition/use-placeholder.tsx @@ -0,0 +1,16 @@ +import { useHeight } from './use-rect'; +import type { Ref, VNode } from 'vue'; +import type { BEM } from '../utils/create/bem'; + +export function usePlaceholder(contentRef: Ref, bem: BEM) { + const height = useHeight(contentRef); + + return (renderContent: () => VNode) => ( +
+ {renderContent()} +
+ ); +}