|
2 жил өмнө | |
---|---|---|
builds | 2 жил өмнө | |
src | 2 жил өмнө | |
.gitignore | 2 жил өмнө | |
LICENSE | 2 жил өмнө | |
README.md | 2 жил өмнө | |
package.json | 2 жил өмнө |
Easy to use and flexible router for Alpine.js
npm install @shaun/alpinejs-router
yarn add @shaun/alpinejs-router
<script src="https://unpkg.com/@shaun/alpinejs-router@1.x.x/dist/cdn.min.js" defer></script>
<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>