tdesign-vue-next
Version:
TDesign Component for vue-next
34 lines (30 loc) • 904 B
JavaScript
/**
* tdesign v1.15.2
* (c) 2025 tdesign
* @license MIT
*/
import { ref, onMounted, watch, onBeforeUnmount } from 'vue';
import { o as observe } from '../../_chunks/dep-6f34ddfa.js';
function useCheckboxLazyLoad(labelRef, lazyLoad) {
var ioObserver = ref();
var showCheckbox = ref(true);
var handleLazyLoad = function handleLazyLoad() {
if (!lazyLoad.value) return;
showCheckbox.value = false;
var io = observe(labelRef.value, null, function () {
showCheckbox.value = true;
}, 0);
ioObserver.value = io;
};
onMounted(handleLazyLoad);
watch([lazyLoad, labelRef], handleLazyLoad);
onBeforeUnmount(function () {
if (!lazyLoad.value) return;
ioObserver.value.unobserve(labelRef.value);
});
return {
showCheckbox: showCheckbox
};
}
export { useCheckboxLazyLoad as default, useCheckboxLazyLoad };
//# sourceMappingURL=useCheckboxLazyLoad.js.map