Toggle Switch Button in VueJs Example

Today, We want to share with you Toggle Switch Button in VueJs Example.In this post we will show you Vue Toggle Switch Button Component, hear for Vue.js toggle / switch button plugin we will give you demo and example for implement.In this post, we will learn about Vue Toggle Switch Button Component with an example.

Toggle Switch Button in VueJs Example

There are the Following The simple About Toggle Switch Button in VueJs Example Full Information With Example and source code.

Read Also:  Laravel 5/6/7 create custom facade

As I will cover this Post with live Working example to develop Bootstrap, Vue, Toggle Status Switch, so the vue-js-toggle-button – npm for this example is following below.

Step 1: Create Vue JS App

In this Phase, I need to make asimple vue.js cli app using bellow simple command run:

vue create pakaApp

Step 2: Install vue-js-toggle-button package

npm install vue-js-toggle-button --save

Step 3: Use simple vue-js-toggle-button

src/main.js

import Vue from 'vue'
import App from './App.vue'
import ToggleButton from 'vue-js-toggle-button'
  
Vue.config.productionTip = false
Vue.use(ToggleButton)
  
new Vue({
  render: h => h(App),
}).$mount('#app')

Step 4: Change App.vue File

src/App.vue

<template>
  <div id="app">
    <Firstapp></Firstapp>
  </div>
</template>
  
<script>
import Firstapp from './components/Firstapp.vue'
   
export default {
  name: 'app',
  components: {
    Firstapp
  }
}
</script>

Step 5: Make Firstapp Component

src/components/Firstapp.vue

<template>
  <div class="container" style="text-align:center">
    <div class="lt-6 mt-6 st-6 dsp">
      <h1 style="font-family:ubuntu">Vue js toggle button example - pakainfo.com</h1>
  
        <toggle-button @change="onChangeEventHandler" :labels="{checked: 'On', unchecked: 'Off'}" style="margin-left: 15px" />
  
        <toggle-button :labels="{checked: 'pakainfo.com', unchecked: 'infinityknow.com'}" width="150" style="margin-left: 15px" />
  
        <toggle-button :labels="{checked: 'Yes', unchecked: 'No'}" style="margin-left: 15px" />
  
    </div>
  </div>
</template>
  
<script>
    
  export default {
    data(){
      return {
        file: ''
      }
    },
  
    methods: {
      onChangeEventHandler(){
          alert('welcome to pakainfo.com');
      }
    }
  }
</script>

run vue app

npm run serve

Web Programming Tutorials Example with Demo

Read :

Read Also:  Google Customize Timelines Charts

Summary

You can also read about AngularJS, ASP.NET, VueJs, PHP.

I hope you get an idea about Toggle Switch Button in VueJs Example.
I would like to have feedback on my infinityknow.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.


Related FAQ

Here are some more FAQ related to this Article:

  1. Read Also:  Laravel get last Eloquent print query
  2. Read Also:  Laravel Vue JS ajax file upload multipart form data
  3. Read Also:  Vue.js onclick Event Handling Example
  4. Read Also:  AngularJS Add ng class to toggle Active Menu
  5. Read Also:  Laravel 7 jQuery Ajax Image Upload Tutorial
  6. Read Also:  Laravel Upload Import CSV Data Into MySQL Database
  7. Read Also:  Laravel Nova Minimum Requirements
  8. Read Also:  Add custom text to image in Laravel with Example
  9. Read Also:  Simple PHP jQuery Ajax Insert Update Delete using MySQLi
  10. Read Also:  get product with Rakuten Marketing API using PHP
CLOSEX