vuestic-ui
Version:
Vue 3 UI Framework
23 lines (22 loc) • 558 B
JavaScript
import { getCurrentInstance, shallowRef, onMounted, onUpdated, onBeforeUnmount } from "vue";
const useCurrentElement = (el) => {
if (el) {
return el;
}
const vm = getCurrentInstance();
const currentEl = shallowRef();
onMounted(() => {
currentEl.value = vm.proxy.$el ?? void 0;
});
onUpdated(() => {
currentEl.value = vm.proxy.$el ?? void 0;
});
onBeforeUnmount(() => {
currentEl.value = vm.proxy.$el ?? void 0;
});
return currentEl;
};
export {
useCurrentElement as u
};
//# sourceMappingURL=useCurrentElement.mjs.map