vuejs toggle class – vue js v-class – Dynamic Components in Vuejs

vuejs toggle class – vue js v-class – Dynamic Components in Vuejs

vuejs toggle class – vue js v-class – Dynamic Components in Vuejs

We can pass some an object data to v-bind:class using vue to dynamically toggle switch on or off classes and A common reqired to need for your data binding is manipulating some an element’s add or remove class list and its new inline styles.

Dynamically Binding Styles

Vue.js some allows for binding styles suppoted and classes dynamically (add or remove class using vuejs) to elements with the directives of vuejs (v-bind:style) and (v-bind:class) directives.

Binding Dynamic multiple styles to an HTML element : Example 1

<button>
  Increase your font size here in Example
</button>
<button>
  Decrease your font size here in Example
</button>

<p>
  Your Dynamic Font size is: {{ fontSize }}
</p>

data: {
  isenable: true,
  isdisable: false
}

index.html : Example 2



  
  <title>VueJS Simple Example</title>
  
      


  
      <button class="btn">
        <span class="fa fa-power-off"></span>
     </button>

  
    


index.js

E-junkie: Sell digital downloads online

E-junkie Provides a Copy-paste buy-now, and cart buttons for selling downloads, codes and tangible products on any website, blog, social media, email and messenger!

Also see:

  1. The Top 10+ Best Webinar Software Platforms For 2020-2021
  2. Build Your Future Godaddy Careers And Jobs
  3. Introduction To Web Hosting Services

new Vue({
  el: 'body',
  data: {
    livecol: true
  },
  methods: {
    flipSwitch: function() {
      this.livecol = !this.livecol;
    }
  }
});

style.css

.body-on {
  background-color: #4285F4;
}
.body-off {
  background-color: #FBBC05;
}
.height-2 {
  min-height: 10em;
}
.btn {
  border-radius: 5em;
  height: 100px;
  width: 100px;
  outline: none;
  background: none 0;
  border: solid thin #444444;
  color: #eeeeee;
  font-size: 3em;
}
.btn-danger {
   background-color: purple;
   color: #4285F4;
}
.btn-success {
  background-color: green;
  color: #FBBC05;
}
.text-center {
   text-align: center;
}

Example

READ :  Angularjs Multiple images slider items - carousel multiple

Example