mint-ui —— switch的使用

Import
按需引入:

import { Switch } from 'mint-ui';

Vue.component(Switch.name, Switch);

 

全局导入:全局导入后不用再导入

importMint from'mint-ui'

import'mint-ui/lib/style.css'

Vue.use(Mint);


  

 

API

mint-ui —— switch的使用

示例
示例一:
xxx.vue:

<template>
  <div id="app">
        <mt-switch v-model="value" @change="turn">Switch</mt-switch>
        
  </div>
</template>
 
<script>
export default {
  name: 'app',
  data () {
      return {
          value: false
      }
  },
  mounted:function(){
      
  },
  methods:{
      turn: function(){
          console.log(this.value)
      }
  }
}
</script>
<style>
    
</style>


 

show:

mint-ui —— switch的使用
点击开关按钮,输出值


备注:

1.

事件只能使用change,不能使用click。