mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-08-18 02:00:10 +08:00
17 lines
452 B
TypeScript
17 lines
452 B
TypeScript
import { Ref } from 'vue';
|
|
import { useHeight } from './use-height';
|
|
import type { BEM } from '../utils/create/bem';
|
|
|
|
export function usePlaceholder(contentRef: Ref<Element | undefined>, bem: BEM) {
|
|
const height = useHeight(contentRef);
|
|
|
|
return (renderContent: () => JSX.Element) => (
|
|
<div
|
|
class={bem('placeholder')}
|
|
style={{ height: height.value ? `${height.value}px` : undefined }}
|
|
>
|
|
{renderContent()}
|
|
</div>
|
|
);
|
|
}
|