/Vue-Router-w-Data-Fetching

Vue Router Test repository. Practicing this concept to learn about vue routing.

Primary LanguageVue

Vue Router Setup Sample

When inside the project directory

Project setup

npm install

Compiles and hot-reloads for development

npm run serve

Compiles and minifies for production

npm run build

JSON Server Bits - watch a file, which in this case is inside data folder

json-server --watch data/db.json

or

npm run json-watch

Learning Outcomes

Vue router injects the appropriate component into the file rather than requesting the server for a new file.

Vue intercepts the route through the URL and checks that so all the routing is done through the client. Therefore, the browswer will not always need to request for a new page from the server.

<router-link> A link to something... </router-link>

  • Router Links are used rather than anchor tags.
  • Router Links can be set to objects because routes are objects.

Customize configuration

See Configuration Reference.