Coder Social home page Coder Social logo

paulweezydesign / astroid Goto Github PK

View Code? Open in Web Editor NEW

This project forked from xisli/astroid

0.0 0.0 0.0 4.19 MB

Leverage Astro full routing capabilities.

Home Page: https://astroid.xis.li

License: MIT License

JavaScript 2.61% TypeScript 18.78% CSS 22.38% Astro 56.22%

astroid's Introduction

Astroid ๐Ÿš€โ˜„๏ธ

# npm
npm i astroid --save-dev

# yarn
yarn add -D astroid

# pnpm
pnpm i astroid --save-dev

Link

---
import { Link } from 'astroid'
---

<Link to="/somewhere" query={{ name: 'Ali', number: '6' }} prefetch={true}>Link name</Link>


Note that prefetching is disabled by default, to enable it use prefetch={true} on the Link component.

router

---
import { Link } from 'astroid'
---
...


<button id="btn">Navigation</button>

<script>
    import { router } from 'astroid'

	const btn = document.getElementById('btn')
		btn.onclick = function () {
			router.push('/there')
		};

</script>

Note that the router should be imported in the script tag.

Params

Returns an object with all params on page

router.params()

Push

To navigate to a page.

router.push(url)

With queries

router.push(url, { name: 'someone' })

Back

To go to the previos page.

router.back()

Reload

To reload a page.

router.reload()

Pathname

Returns the page pathname

router.pathname()

Prefetch

To prefetch a page.

router.prefetch('/page')

With queies do

router.prefetch('/page', { using: 'router' })

astroid's People

Contributors

xisli avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.