This is the second post in a series that started here. If you’d like some context, then please visit the first post. In this post, I’ll be refactoring the small amount of code that we currently have, into Vue Components.
You can find the code for this post here.
Refactoring into Global Components
Let’s start with a very simple component, and that’s the display of “Seconds Remaining”. For the time being, we’ll create this in the same file, so all we’re doing here is shuffling code around. Instead of the following code:
<p>{{ secondsRemaining }}</p>
We’ll add this:
[code lang=“html”] <div id=“app”> <div v-bind:style=“location”>