GithubHelp home page GithubHelp logo

vue-router's Introduction

@npkg/vue-router@next release candidate GitHub license Download Hexo Version

This is the repository for Vue Router 4 Extended version (for Vue 3) For the Vue2.0 router see the npm-pkg/vue-router. The extension supports automatic jump to external link


View Chinese document

Quickstart

  • Via CDN: <script src="https://unpkg.com/@npkg/vue-router@next"></script>

  • Add it to an existing Vue Project:

    npm install @npkg/vue-router@next
    |
    yarn add @npkg/vue-router@next

Usage

Replace all places of vue-router with @npkg/vue-router

Create routing instance

//# /src/router/index.js

/*
 * Old code
 */
import {
  createRouter,
  createWebHistory,
} from "vue-router";

// Create routing instance
export const router = createRouter({
  history: createWebHistory(),
  routes: [{
      ...
  }]
  }
});


//---------------------------------
// replace with the following code
//-----------------------------------


/*
 * New code
 */
import {
  createRouter,
  createWebHistory,
} from "@npkg/vue-router";

// Create routing instance
export const router = createRouter({
  history: createWebHistory(),
  routes: [{
       ...
  }]
  }
});

/*
 * Other 
 */

 import { useRoute, useLink } from "@npkg/vue-router";
 let router = useRouter()
 router.push({path:'/'})

Based on the original Vue router, it additionally supports the following writing methods

// Basic usage

<router-link to="/"></router-link>

<router-link to="/list"></router-link>

<router-link to="https://github.com/npm-pkg/vue-router"></router-link>

<router-link to="https://github.com/npm-pkg/vue-router?author=five-great"></router-link>

<router-link to="https://github.com/npm-pkg/vue-router/tree/v4.0.15#readme"></router-link>

//Advanced Usage

<router-link :to="{path: '/'}"></router-link>

<router-link :to="{path: '/list'}"></router-link>

<router-link :to="{path:'https://github.com/npm-pkg/vue-router'}"></router-link>

<router-link :to="{path:'https://github.com/npm-pkg/vue-router', query:{author: 'five-great'}}"></router-link>

<router-link :to="{path:'https://github.com/npm-pkg/vue-router/tree/v4.0.15',hash:'#readme'}"></router-link>

<router-link :to="{path:'https://github.com/:org/:repo',params:{org:'npm-pkg',repo: 'vue-router'}}"></router-link>

<router-link :to="{path:'https://github.com/:org/:repo/tree/:v',query:{author: 'five-great'},params:{org:'npm-pkg',repo: 'vue-router',v:'v4.0.15'},hash:'#readme'}"></router-link>

Get started with the documentation.

Contact

github https://github.com/npm-pkg/vue-router

Email [email protected]

CSDN Five-菜鸟级

vue-router's People

Contributors

five-great avatar

Stargazers

 avatar  avatar

Watchers

 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.