Vue.js的可定制翘板开关组件

Vue摇杆开关 (vue-rocker-switch)

A customizable rocker switch component for Vue.js.

Vue.js的可定制翘板开关组件。

vue-rocker-switch

安装 (Installation)

npm install vue-rocker-switch --save

使用范例 (Usage example)

<template>
  <RockerSwitch />
</template>

<script>
// Import package
import RockerSwitch from "vue-rocker-switch";
// Import styles
import "vue-rocker-switch/dist/vue-rocker-switch.css";

export default {
  name: "App",
  components: {
    RockerSwitch
  }
};
</script>

道具 (Props)

PropDescriptionDefault valueType
valueBoolean value attached to the rocker switcher. This will be used to initialize the component value too.falseBoolean
sizerocker switch size, it can be a string (small, medium and large) or a decimal numbersmallString or Number
labelOnText of the On labelOnString or Number
labelOffText of the Off labelOffString or Number
activeColorLabelText color used when the On label is active
#fff
#fff
String
inactiveColorLabelText color used when the Off label is inactive#333String
backgroundColorOnBackground color of the On button
#0084d0
#0084d0
String
backgroundColorOffBackground color of the Off button#bd5757String
borderColorBorder color of the rocker switch
#eee
#eee
String
toggleAllow to the rocker switch to behave as a toggle switchtrueBoolean
Struts 描述 默认值 类型
附加到翘板开关的布尔值。 这也将用于初始化组件值。 false 布尔型
尺寸 翘板开关大小,可以是字符串( smallmediumlarge )或十进制数 small 字符串或数字
labelOn 该文本On标签 On 字符串或数字
labelOff Off标签的文字 Off 字符串或数字
activeColorLabel 启用“ On标签时使用的文本颜色 #fff
inactiveColorLabel Off标签处于非活动状态时使用的文本颜色
#333
#333
backgroundColorOn On按钮的背景颜色 #0084d0
backgroundColorOff Off按钮的背景颜色
#bd5757
#bd5757
边框颜色 翘板开关的边框颜色 #eee
拨动 允许翘板开关充当拨动开关 true 布尔型

大事记 (Events)

EventDescription
changeFires each time the rocker switch changes.
事件 描述
更改 每次翘板开关改变时触发。

开发设置 (Development setup)

npm install

编译和热重装以进行开发 (Compiles and hot-reloads for development)

npm run serve

编译并最小化生产 (Compiles and minifies for production)

npm run build

整理和修复文件 (Lints and fixes files)

npm run lint

翻译自: https://vuejsexamples.com/a-customizable-rocker-switch-component-for-vue-js/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值