Ei kuvausta

Shaun Li 33f373556c use $router magic insteand of $store.router 2 vuotta sitten
builds 517b9633b4 Easy to use and flexible router for Alpine.js 2 vuotta sitten
src 33f373556c use $router magic insteand of $store.router 2 vuotta sitten
.gitignore 517b9633b4 Easy to use and flexible router for Alpine.js 2 vuotta sitten
LICENSE 517b9633b4 Easy to use and flexible router for Alpine.js 2 vuotta sitten
README.md c64b8468d7 installation doc 2 vuotta sitten
package.json 0ca3470275 template loading indicator 2 vuotta sitten

README.md

alpinejs-router

Easy to use and flexible router for Alpine.js

Installation

npm

npm install @shaun/alpinejs-router

yarn

yarn add @shaun/alpinejs-router

cdn

<script src="https://unpkg.com/@shaun/alpinejs-router@1.x.x/dist/cdn.min.js" defer></script>

Getting Started

<a x-link href="/hello/world">Hello World</a>

<a x-link href="/somewhere">Load template</a>

<template x-route="/hello/:name">
  <div>Say hello to <span x-text="$store.router.params.name"></span></div>
</template>

<template x-route="/somewhere" template="/somewhere.html"></template>

somewhere.html

<div x-data="{ open: false }">
  <button @click="open = ! open">Toggle Content</button>

  <div x-show="open">Content...</div>
</div>