From the course: Building Vue and Node Apps with Authentication

Unlock the full course today

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

Getting input data

Getting input data

From the course: Building Vue and Node Apps with Authentication

Start my 1-month free trial

Getting input data

- [Instructor] In this video, we'll wire up our New Message component so that when we hit the submit button, we can display whatever we typed in our Message field. So back in our front end project on line 15, we can see our submit button. We currently have click set to nothing so let's set it to a function called submit and now we'll actually need to create that function. So within our script, below our data function, let's add our methods. So I'll create a new object here and then let's define our new method within that. So let's call submit and inside, I'll simply use a console.log, and type in a test string. Let's save that and give it a try. So with our Console open, I'll hit submit. And we can see our test message is displaying. So now let's look at how to get the value from our Message field. To do that, we'll have to bind to it. So let's go up to our Message field on line 11 and we'll use the v-model property to do that. And we need to set this to a variable that we'll bind to.…

Contents