Files
vant/src/composition/use-lazy-render.ts
T

14 lines
277 B
TypeScript

import { ref, isRef, watch, WatchSource } from 'vue';
export function useLazyRender(show: WatchSource<boolean>) {
const inited = ref(isRef(show) ? show.value : show());
watch(show, (value) => {
if (value) {
inited.value = value;
}
});
return inited;
}