Components are one of the most powerful features of Vue. Let's take a look at how to write our first components and make use of them in a parent component.
Instructor: [00:00] Let's start by making a components folder. Inside the folder we'll have item description, item image, and item title. These will separate components that we can put together in our app. Now we can write the components that we're going to use.
[00:15] We're making a page that's going to show some information and the picture of my cat, Opel. Let's write an item title, an item description, and an item image. Let's start writing the parent Vue template which is going to make use of those components.
[00:32] We'll start by importing each Vue components. Then, we need to declare each component individually within the component's object. We can do this using the ESX object showhand.
[00:46] Let's write our template. It's going to be a div with the idea of app whose children are each of the three components. The template is referring to the components that we specify down here. The only difference is that we're using kebab-case up here in our template whereas down here, it's capitalized.
[01:04] Let's run a dev instance of our app and see if it works. There we have the item image, the item title, and the item description, and we can inspect all of these in our Vue dev tools as well.
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!