From the course: Vue.js 3 Essential Training

Unlock this course with a free trial

Join today to access over 22,600 courses taught by industry experts.

Classes

Classes

- [Instructor] In the same way that you can use inline styles, view lets you control how classes are added and deleted, based on the state of your applications. To do this, we can use v-bind to bind classes to different variables. And this is what it looks like. You don't need to use the keyword v-bind that is actually optional, just like with style and other properties. And in this case, this would be a pretty simple way of toggling a class on and on so let's go ahead and show you we can delete this if we want to. And then this would be the name of some class just like with styles, this can be kebab case, or camel case. And this particular use of a Boolean right here would make it very easy to turn this class on and off depending on the value of a variable. So this is what we call controlling the application state. State is really that section in your data part of the application that has all the variables, we call…

Contents