winbox-ui-next
Version:
We Design Vue 2.0: A Vue.js 3 UI Library
20 lines (19 loc) • 529 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports[Symbol.toStringTag] = "Module";
var vue = require("vue");
var is = require("../_utils/is.js");
const useComponentRef = (name) => {
const componentRef = vue.ref();
const elementRef = vue.computed(() => {
if (is.isComponentInstance(componentRef.value)) {
return componentRef.value.$refs[name];
}
return componentRef.value;
});
return {
componentRef,
elementRef
};
};
exports.useComponentRef = useComponentRef;