Home > Blockchain >  How to put two conditionals in :class VueJS
How to put two conditionals in :class VueJS

Time:02-03

I'm creating a sidebar with a lot of features soo I need add two conditionals in my :class, but i don't know how to do this. That's what I do:

:

CodePudding user response:

You can do in object style:

Example:

{
  'open': showSidebar,
  'closed': !showSidebar,
  'openmini': showSidebarMini,
  'closedmini': !showSidebarMini
}

In your case:

:

CodePudding user response:

you can use array of classes:

:

CodePudding user response:

you must use object syntax when you have a condition in class

v-bind:

and use array in your class when you need toggle class

v-bind:
  •  Tags:  
  • Related