npm.io
0.2.9 • Published 3d ago

@vue-lynx-example/vue-router

Licence
Apache-2.0
Version
0.2.9
Deps
2
Size
245 kB
Vulns
0
Weekly
0
Stars
457

Vue Router Example

Demonstrates Vue Router running in a Lynx environment using createMemoryHistory().

Why Memory History?

Lynx has no window.location or History API, so the standard createWebHistory() and createWebHashHistory() won't work. createMemoryHistory() keeps all routing state in-process — similar to React Router's MemoryRouter or TanStack Router's memory history.

Key Patterns

  • NavLink.vue — Lynx has no <a> tag, so RouterLink's default rendering doesn't apply. This component uses RouterLink's custom + v-slot API to render native <text> elements with @tap handlers while preserving isActive state for styling.
  • Programmatic navigationrouter.push(), router.back() work as expected.
  • Dynamic route params/users/:id with useRoute().params.

Getting Started

Install dependencies from the repo root:

pnpm install

Then build or run the dev server:

pnpm run dev
# or
pnpm run build