Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

nuke-switch

Package Overview
Dependencies
Maintainers
3
Versions
68
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nuke-switch

开关

  • 2.1.1-1
  • npm
  • Socket score

Version published
Weekly downloads
9
decreased by-68.97%
Maintainers
3
Weekly downloads
 
Created
Source

Switch

  • category: Components
  • chinese: 开关
  • type: 基本

何时使用

Switch 是状态切换的开关按钮组件。

API

注意:Switch 在客户端上是个非受控组件

属性说明类型默认值
type展现 安卓 还是 iOS 风格,如果不传,默认根据设备自动切换,可选 android iOS
disabled开关是否可交互booleantrue
defaultChecked默认是否选中(非受控用法)booleanfalse
onValueChangeSwitch 改变时调用此函数function(value)

Demo

非受控用法: 组件自身自由改变,并通过事件通知外部改变成了什么。如下 demo :

change = (value) => {
    console.log('switch 改变成了:',value);
}
//...
render(){
    return (<Switch defaultChecked={true} onValueChange={this.change}/>)
}

Keywords

FAQs

Package last updated on 15 Aug 2018

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc