UNPKG

@inkline/inkline

Version:

Inkline is the intuitive UI Components library that gives you a developer-friendly foundation for building high-quality, accessible, and customizable Vue.js 3 Design Systems.

28 lines (27 loc) 796 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.useLinkable = useLinkable; var _vue = require("vue"); var _useInkline = require("@inkline/inkline/composables/useInkline"); function useLinkable(props) { const inkline = (0, _useInkline.useInkline)(); const isLink = (0, _vue.computed)(() => { return props.to.value || props.href.value; }); const tag = (0, _vue.computed)(() => { const routerComponent = inkline?.options?.routerComponent; if (props.to.value && routerComponent) { return typeof routerComponent === "string" ? (0, _vue.resolveComponent)(routerComponent) : routerComponent; } else if (props.href.value) { return "a"; } else { return props.tag.value; } }); return { tag, isLink }; }