UNPKG

winbox-ui-next

Version:

We Design Vue 2.0: A Vue.js 3 UI Library

17 lines (16 loc) 415 B
import { ref, computed } from "vue"; import { isComponentInstance } from "../_utils/is.js"; const useComponentRef = (name) => { const componentRef = ref(); const elementRef = computed(() => { if (isComponentInstance(componentRef.value)) { return componentRef.value.$refs[name]; } return componentRef.value; }); return { componentRef, elementRef }; }; export { useComponentRef };