Skip to content
This repository has been archived by the owner on Jul 17, 2020. It is now read-only.

Latest commit

 

History

History
23 lines (12 loc) · 1001 Bytes

02-vue-js-create-routes-in-vue-and-understand-the-path-hierarchy.md

File metadata and controls

23 lines (12 loc) · 1001 Bytes

Video Link

02. Create Routes in Vue and Understand the Path Hierarchy

First in main.js import new page components, in this example they will be Egghead and Blog

import Egghead from './components/Egghead'
import Blog from './components/Blog'

Inside the routes array create new route records which are objects. Make a key named path and set to the value '/blog'. Make another route record object with a key named component and set it to 'Blog'.

For the Egghead component creaate another object set the path key to /blog and the componet key to Egghead.

When you the visit /blog the Blog component will display not Egghead. That's because when you have matching routes the first route record is given higher priority and gets shown

Resources

Route Matching Docs