Introducing vue-router
For a single-page application, when a user switches from one page (logic page) to another, the application will need to update the URL in the address bar accordingly so that when the user refreshes the page or copies the URL and shares it with others to open, the application will always render the same page. In Vue applications, we can achieve this by using vue-router (https://router.vuejs.org/guide), which is already included in the frontend scaffold that we generated.
In this section, we will only cover the features of vue-router that we need at the moment. For those features that we don't talk about here, we will introduce them later in this book.
As you probably have noticed, in App.vue there is <router-view> inside ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access