Become a member
to unlock all features

Level Up!

Access all courses & lessons on egghead today and lock-in your price for life.


    Create Routes in Vue and Understand the Path Hierarchy

    Laurie BarthLaurie Barth

    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.



    Become a Member to view code

    You must be a Member to view code

    Access all courses and lessons, track your progress, gain confidence and expertise.

    Become a Member
    and unlock code for this lesson




    Instructor: 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.

    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.