From the course: Vue.js 2 Essential Training

Unlock the full course today

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

Using methods

Using methods

From the course: Vue.js 2 Essential Training

Start my 1-month free trial

Using methods

- [Instructor] We've already had a bit of experience with methods from the previous chapter, and computer properties from the last video. And the difference is in how they cache the values that are generated. So, let's take a look at the difference by adding something to our slug here. So what I'll do is, I'll create another computed property, here. And I'm going to call it now, and for now I'll have it return, just a couple of dashes. And then I'll come here to slugetize, and add myself a dash plus whatever I get from now. So, that's actually going to add three dashes. That's the case, so, let's now return something more meaningful. So to return to date, I'm going to create a variable called date and make that equal to new date and then I can return using the date, the hours. Alright, so date.gethours should get us the hour number, it's in 24 hour sort of code. Let's also go ahead and add minutes and seconds. It's unfortunately because these are numbers it's going to just add 'em all…

Contents