vue-router-push

One line command, write router file and create new page file.
529 1
Install
npm install vue-router-push
Latest Version:0.0.9
License:MIT
Last Updated:Sep 20, 2022
Links: GitHub  ·  npm
Maintainer: ignorezyt

vue-router-push

One line command, write router file and create new page file.

Install

npm i -g vue-router-push

Usage

vrp /user/info/list

Make sure you have a file vrp.config.json in your root directory.

{
    "routerPath": "/src/router/index.ts",
    "pageDir": "/src/views",
    "componentPrefix": "../views"
}

The routing configuration is saved using a variable called routes .

import { createRouter, createWebHistory } from 'vue-router';
import HomeView from '../views/HomeView.vue';

const routes = [{
  path: '/',
  name: 'home',
  component: HomeView
}, {
  path: '/about',
  name: 'about',
  component: () => import('../views/AboutView.vue'),
}];

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes
});
export default router;

You can choose to create a file vrp.template.vue in the root directory to use as a template for new files, or use the default.

<script lang="ts" setup>
    import { reactive, ref } from 'vue';
    const state = reactive({});
</script>
<template>
    <div class="">
        <router-view></router-view>
    </div>
</template>
<style>
    
</style>

Related Packages

@web-types/vue-router

Web-types for vue-router

1,340,437 306
@fastkit/vue-location

vue-location

5,514 6
@owlsdepartment/vue-tree-routes

Small library to write Vue routes definition in a tree structure.

1,009 5
vue-routes-design

简化vue-router的路由配置

914 5
vuex-router-sync

Effortlessly keep vue-router and vuex store in sync.

4,091,575 2,487

Version History

Version Released License
0.0.9 MIT
0.0.8 MIT
0.0.7 MIT
0.0.6 MIT
0.0.5 MIT
Pre-releases (1)
Version Released License
0.0.1-beta MIT