npm.io
0.2.6 • Published 6 years ago

hb-switch

Licence
—
Version
0.2.6
Deps
4
Size
162 kB
Vulns
1
Weekly
0

hb-switch

Project setup

npm install hb-switch -S

在 main.js 文件中引入插件并注册

import Switch from 'hb-switch'
Vue.use(Switch)
在项目中使用 hb-switch
<template>
  <hb-switch :title="('默认 false')"></hb-switch>
</template>
<script>
  export default {
    data () {
      return {
        textHtml: '<span style="color:red">我是红色</span>'
      }
    },
    methods: {
        onClick (newVal, oldVal) {
          console.log(newVal, oldVal)
        }
      }
  }
</script>
特点
简单易用,UI在原插件基础上优化增加了圆角和过渡动画
提供以 npm 的形式安装提供全局组件
选项
你可以通过在所在的元素上设置以下属性来配置hb-switch
textHtml:配置颜色,如<span style="color:red">我是红色</span>
disabled:禁用状态,如disabled
事件
@click="onClick"点击事件
<hb-switch disabled :title="textHtml" @click="onclick"></hb-switch>