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.

Text field bindings

Text field bindings - Vue.js Tutorial

From the course: Learning Vue.js

Start my 1-month free trial

Text field bindings

- In this video, we'll take a look at a very simple HTML form, and talk about how to manage text fields using Vue. In my code editor, you can see that this is indeed a form element with an input of type text and then a text area for lengthier input. And then below we have the submit button. Our view app is created the same way as before and I'm starting with a data object that has only the deck name property for now. So we've already seen that we can use v-bind value, or the shorthand version, just colon value to pre-populate a text field with a given value. And remember that value could be a data property, or a JavaScript expression. Or even something like math dot random. So let's use deck name instead. And if this were an existing flashcard deck that we were just editing, it might be perfectly fine to preload that value, and then just use a traditional form submission to update it. But if we did that, why would…

Contents