@bisquit/vue-router-composable
TypeScript icon, indicating that this package has built-in type declarations

0.0.2 • Public • Published

vue-router-composable

Use vue router with composition API in Vue 2

Installation

npm install @bisquit/vue-router-composable
# or
yarn add @bisquit/vue-router-composable

Usage

Before using this package, you should install and setup @vue/composition-api.

useRouter()

import { useRouter } from '@bisquit/vue-router-composable';

export default {
  setup() {
    const router = useRouter();

    const onClick = () => {
      router.push('/');
    };
  },
};

useRoute()

import { useRoute } from '@bisquit/vue-router-composable';

export default {
  setup() {
    const route = useRoute();

    // `route` is a ref, so use with `unref` or `.value`
    const { query } = route.value;
    doSomething(name: query.name);
  },
};

License

MIT

Readme

Keywords

Package Sidebar

Install

npm i @bisquit/vue-router-composable

Weekly Downloads

2

Version

0.0.2

License

MIT

Unpacked Size

3.62 kB

Total Files

5

Last publish

Collaborators

  • bisquit