⚠️ This lesson is retired and might contain outdated information.

Create Routes in Vue and Understand the Path Hierarchy

Laurie Barth
InstructorLaurie Barth
Share this video with your friends

Social Share Links

Send Tweet
Published 5 years ago
Updated 9 months ago

We can create routes with other URL paths. It's important to know that the router will navigate to the first matching path it finds in the route record array. So matching paths will be ignored once the first match is found.

Instructor: [00:01] We'll start by importing two new page components, egghead and blog. Next, we'll make a new route record, which is an object. We'll set our path to /blog and set our component to blog. We'll also make a route record for our egghead component, but we're going to set our path to /blog.

[00:52] When we do this, and navigate to /blog, we'll find that we see the blog component and not the egghead component. With matching routes, the first route record in the hierarchy wins. Now, we'll change our path to /egghead, and we'll be able to navigate to our egghead route, which shows our egghead component.