Home > Back-end >  how to change styles depending of true/false in vuejs
how to change styles depending of true/false in vuejs

Time:01-24

please i'm trying to change the style if one of the classes returns true

this my template

            <div
              
              :
             
              @click=" orders"
            >
              <div >
                Orders
              </div>
          
            </div>

please how do i go about this

CodePudding user response:

Do this;

<div 
    :
    @click="orders"
>

CodePudding user response:

I assume you talking about Conditional Rendering this offical sample code should be clear about how to use v-if

<script>
export default {
  data() {
    return {
        awesome: true
    }
    }
}
</script>

<template>
  <button @click="awesome = !awesome">toggle</button>

    <h1 v-if="awesome">Vue is awesome!</h1>
    <h1 v-else>Oh no            
  • Related