Installation | vue router direct
GettheVueRouterCheatSheetfromVueMasteryPackagemanagers[2]IfyouhaveanexistingprojectthatusesaJavaScriptpackagemanager,youcaninstallVueRouterfromthenpmregistry:Ifyourestartinganewproject,youmightfinditeasiertousethecreate-vue[3]scaffoldingtool,whichcreatesaVite-basedprojectwiththeoptiontoincludeVueRouter:Youllbepromptedwithsomequestionsaboutthekindofprojectyouwanttocreate.IfyouchoosetoinstallVueRouter,theexampleapplicationwillalsodemonstratesomeofVueRouterscorefeatures.Projectsusingpackageman...
Get the Vue Router Cheat Sheet from Vue Mastery Package managers [2]If you have an existing project that uses a JavaScript package manager, you can install Vue Router from the npm registry:
If youre starting a new project, you might find it easier to use the create-vue[3] scaffolding tool, which creates a Vite-based project with the option to include Vue Router:
Youll be prompted with some questions about the kind of project you want to create. If you choose to install Vue Router, the example application will also demonstrate some of Vue Routers core features.
Projects using package managers will typically use ES modules to access Vue Router, e.g. import { createRouter } from vue-router.
Direct Download / CDN [4]https://unpkg.com/vue-router@4[5]
Unpkg.com[6] provides npm-based CDN links. The above link will always point to the latest release on npm. You can also use a specific version/tag via URLs like https://unpkg.com/[email protected]/dist/vue-rou...