Vue-router comes with a built-in router-link component that can be used for navigation links between pages.
Instructor: [00:02] Vue has a tag built in called router-link, which can help with all of your router template needs.
[00:12] We'll start with the router-link and put an internal <h3> tag so that it will expand to meet the space of the text. Now we want to add a to path, which is where this router-link will take us. We'll send it to /egghead. If we refresh our page and click on the link, we'll go to our Egghead page.
[00:46] If we want to change the styling of the router-link, there are many API options. tag="button" is one of them. Now our link appears as a button.
[01:00] If we want to navigate to blog and handle parameters in our navigation, we need to navigate using an object. We use the name that we've set for the blog route record, blog, and send params as another object with key id and a value of 1, 2, 3, 4. If we click on the router-link, we see that we've successfully navigated to blog 1, 2, 3, 4.
Member comments are a way for members to communicate, interact, and ask questions about a lesson.
The instructor or someone from the community might respond to your question Here are a few basic guidelines to commenting on egghead.io
Be on-Topic
Comments are for discussing a lesson. If you're having a general issue with the website functionality, please contact us at support@egghead.io.
Avoid meta-discussion
Code Problems?
Should be accompanied by code! Codesandbox or Stackblitz provide a way to share code and discuss it in context
Details and Context
Vague question? Vague answer. Any details and context you can provide will lure more interesting answers!