The new Vue.js 3.0 plugin architecture is nice, but it seems to to be missing a router plugin. If I choose not to install routing when I first create the project (vue create my-project
), I'd expect that I could change my mind later and add routing with something like vue add @vue/router
, but that plugin doesn't appear to exist. Is there a way to add routing from the CLI after the fact?
To use vue as command in cmd. Open the cmd as admin and run the the following command. setx /M path "%path%;%appdata%\npm" Now restart the cmd and run the vue again. It should work just fine.
Simple Routing from Scratch If you only need very simple routing and do not wish to involve a full-featured router library, you can do so with Dynamic Components and update the current component state by listening to browser hashchange events or using the History API.
After some experimenting with vue-cli3, i found that you can use vue add
to setup components you missed.
Use vue add router
That set up the routing and created some sample components Home and About.
This also work for other modules like adding vuetify with vue add vuetify
. You can read more about vue add from the plugins and presets guide
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With