@vuecs/link
@vuecs/link
<VCLink> — one anchor for every routing setup, part of vuecs. Detects the environment and renders <NuxtLink>, <RouterLink>, or a plain <a> — so library components (and your own) never hard-code a router.
✨ What's inside
- 🧭 Auto-detection — Nuxt →
<NuxtLink>, vue-router →<RouterLink>, neither →<a>. No configuration, no direct router dependency. - 🔗
toorhref— route location object/string for router navigation,hreffor plain anchors;querymerging included. - 🚦 Stateful props —
activeanddisabledflow into rendering and clicks;clickedemit for selection-style flows (used by@vuecs/navigation's url-less section switchers). - ⚡ Prefetch control —
:prefetchforwarded to<NuxtLink>(defaulttrue).
📦 Installation
npm install @vuecs/link
⚡ Usage
<VCLink to="/dashboard">Dashboard</VCLink>
<VCLink href="https://github.com/tada5hi/vuecs" target="_blank">GitHub</VCLink>
<VCLink :to="{ name: 'user', params: { id } }" :disabled="!canVisit">Profile</VCLink>
<VCLink to="/password" :query="{ ref: '/account' }">Change password</VCLink>
Threading a link descriptor through your own data? Type it with LinkProps —
derived from the component's prop declaration, so it can't drift, and free of
an index signature, so misspelled props are compile errors:
import type { LinkProps } from '@vuecs/link';
const link: LinkProps = { to: '/password', query: { ref: '/account' } };
📚 Documentation
Full reference: vuecs.dev/components/link
License
Made with 💚
Published under Apache 2.0 License.
Related Packages
nuxt-canonical
Module for automatically generating canonical tags for all pages in your nuxt pr...
4,953
19
vue-extend-layout
Extend the default layout or create custom layouts for your SPA Vue.js
110,412
128
Version History
| Version | Released | License |
|---|---|---|
| 2.1.2 | Apache-2.0 | |
| 2.1.1 | Apache-2.0 | |
| 2.1.0 | Apache-2.0 | |
| 2.0.3 | Apache-2.0 | |
| 2.0.2 | Apache-2.0 | |
| 2.0.1 | Apache-2.0 | |
| 2.0.0 | Apache-2.0 | |
| 1.0.1 | ||
| 1.0.0 |