1.0.18 • Published 3 years ago

vite-plugin-vue-router v1.0.18

Weekly downloads
606
License
MIT
Repository
github
Last release
3 years ago

vite-plugin-vue-router

vite-plugin-vue-router is File system base vue-router plugin for Vite

Quick start

  1. install
yarn add vite-plugin-vue-router -D
  1. Use it in your project

Use it in vite.config.js

import configRouterPlugin from 'vite-plugin-vue-router';

export default defineConfig({
  plugins: [
    configRouterPlugin(),
  ],
});
  1. Introduce the required packages in main.js
import { createApp } from 'vue';
import App from '. /src/App.vue';
import router from '@pages-generated';
createApp(App).use(router).mount('#app');

4,middleware

//type1 test.js
//this type will be used as router.beforeEach
export default ({to,from,next}) => {}


//type2 test2.js
//this type will be used as router.beforeEach and router.afterEach
const beforeEach = ({to,from,next}) => {};
const afterEach = ({to,from}) => {};
export default {beforeEach,afterEach};

Project directory

vite-plugin-vue-router uses an agreed-upon directory format, so we need to follow this development style. It is often an effective measure to achieve uniformity and efficiency in a project.

├── public
├── src
    ├── layout
        ├─ Index.vue
    ├─ middleware
    ├── views
        └── Index.vue
    └── App.vue
├── index.html
├─ package.json
├─ vite.config.ts
1.0.18

3 years ago

1.0.16

3 years ago

1.0.15

3 years ago

1.0.14

3 years ago

1.0.13

3 years ago

1.0.12

3 years ago

1.0.9

3 years ago

1.0.8

3 years ago

1.0.11

3 years ago

1.0.10

3 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago