From the course: Learning Vue.js

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Creating and registering components

Creating and registering components - Vue.js Tutorial

From the course: Learning Vue.js

Start my 1-month free trial

Creating and registering components

- We've talked a little bit along the way about strategies for cleaning up our templates. One of the most effective tools that Vue offers us in that regard is its component system, which allows us to encapsulate sections of our template and make them easier to reason about and debug. Let's target a section of our template for component extraction. We'll start with something simple like the "read more" link here and to make it even simpler, we're going to temporarily change this to a static href attribute and just put the URL for the guide there instead of "read more" URL. But, we'll leave the "read more" data property down there so that we can reintroduce it soon. What using components will enable us to do is remove this element from the template. I'm going to cut it to the clipboard and then we can replace it with a custom element that I'll call "read more" that will look something like this with open and closed tags.…

Contents