Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

quark-switch

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

quark-switch

一种基于vue框架的滑动开关组件

latest
npmnpm
Version
1.0.1
Version published
Maintainers
1
Created
Source

Switch 滑动开关

用来打开或关闭选项。

基本用法

<quark-switch 
  :active="true"
>
</quark-switch>

加上 .sync 可实现数据的“双向绑定”。

<quark-switch 
  :active.sync="swActive"
>
</quark-switch>
export default {
  data() {
    return {
      swActive: true
    };
  }
};

自定义尺寸

内置 smallbaselarge 三种规格供使用。

<quark-switch 
  :active="true" 
  size="small"
>
<quark-switch 
  :active="true" 
  size="base"
>
<quark-switch 
  :active="true" 
  size="large"
>

change事件

<quark-switch 
  @change="onChange"
>
</quark-switch>
export default {
  methods: {
    onChange(status) {
      alert(status);
    }
  }
};

禁用状态

<quark-switch 
  :disabled="true"
>
</quark-switch>

禁用状态下,change事件参数永远为初始值

自定义Class

<quark-switch 
  :active="true"  
  class="my-switch"
>
</quark-switch>

Prop

字段说明类型默认值
active开关状态Booleanfalse
size尺寸,可选值small/base/largeStringbase
disabled是否禁用Booleanfalse

Keywords

vue

FAQs

Package last updated on 04 Nov 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts