暫無描述

Shaun Li c64b8468d7 installation doc 2 年之前
builds 517b9633b4 Easy to use and flexible router for Alpine.js 2 年之前
src 517b9633b4 Easy to use and flexible router for Alpine.js 2 年之前
.gitignore 517b9633b4 Easy to use and flexible router for Alpine.js 2 年之前
LICENSE 517b9633b4 Easy to use and flexible router for Alpine.js 2 年之前
README.md c64b8468d7 installation doc 2 年之前
package.json 0e99ee75c3 rename 2 年之前

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>