New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

taro-dropdown

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

taro-dropdown

taro dropdown component

  • 0.3.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

taro-dropdown NPM Version Size Download License

基于 Taro 的一个 dropdown 菜单的组件

安装

Taro 2

# yarn
yarn add taro-dropdown

# npm
npm i taro-dropdown

代码演示

<Dropdown
  renderOverlay={
    <View>
      <View>item1</View>
      <View>item2</View>
      <View>item3</View>
    </View>
  }
>
  <Button>click me</Button>
</Dropdown>

效果截图

image.jpg

API

Props 属性如下

参数说明类型默认值
renderOverlay菜单Node节点ReactNode-
overlayClassName下拉菜单根元素的类名称string-
overlayStyle下拉菜单根元素的样式CSSProperties-
placement菜单弹出位置:bottomLeft bottomCenter bottomRight topLeft topCenter topRightstringbottomLeft
disabled菜单是否禁用boolean-
visible菜单是否显示,传入该值则需要自己手动控制菜单的显示与隐藏boolean-
arrow下拉框箭头是否显示booleantrue
zIndex菜单以及mask的层级number5000
classNamedropdown 组件的根元素类名string-
customStyledropdown 组件的根元素样式CSSProperties-
hasPosition组件的祖先元素是否含有 position 非 static 的情况,如果有请传入该属性,否则会出现定位有误boolean-
align该值将合并到 placement 的配置中,设置参考 taro-dom-alignobject-
onVisibleChange菜单显示状态改变时调用,参数为 visiblefunction(visible) -

⚠ 注意

  • 目前仅支持 微信小程序
  • 由于小程序的限制,组件传入的 children 不能脱离父级文档,否则将会导致菜单的定位出现错误
  • 由于小程序的限制,当菜单组件的祖先元素含有 position 非 static 的情况,要设置 hasPosition,否则将会导致菜单的定位出现错误

许可

MIT © John60676

Keywords

FAQs

Package last updated on 26 Sep 2020

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