Socket
Socket
Sign inDemoInstall

miniprogram-float-button

Package Overview
Dependencies
0
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    miniprogram-float-button

a fly out button(motion button)


Version published
Weekly downloads
10
increased by900%
Maintainers
1
Install size
1.01 MB
Created
Weekly downloads
 

Readme

Source

miniprogram-float-button

a fly out button(motion button)

安装组件

npm install --save miniprogram-float-button

用法及demo

image

  1. 在需要用到的wxml页面上添加以下代码
<float-button 
  bind:toggle='toggle' 
  floatButtonChildData='{{floatButtonChildData}}' 
  right="{{120}}" 
  bottom="{{120}}" 
  mainImg="{{mainImg}}"
></float-button>
  1. 在相应的小程序js文件添加以下代码
function hello() {
  // eslint-disable-next-line no-console
  console.log('say hello')
}

Page({
  data: {
    floatButtonChildData: [{
      src: './images/frown.png',
      content: '不开心',
      onClick: hello
    },
    {
      src: './images/message.png',
      content: '我的信息',
      // eslint-disable-next-line no-console
      onClick: () => console.log('1')
    },
    {
      src: './images/user.png',
      content: '关于我',
      // eslint-disable-next-line no-console
      onClick: () => console.log('2')
    }
    ],
    mainImg: './images/plus.png',
    isOpen: false,
  },
  toggle(e) {
    // eslint-disable-next-line no-console
    console.log(e.detail)
  },
})
  1. 在相应的小程序json文件添加以下代码
  "usingComponents": {
    "float-button": "/path/component"
  }

base-modal 的属性和方法介绍如下:

1.属性
选项描述类型默认值
bind:toggle点击modal取消按钮eventevent
mainImg主按钮的图片image
floatButtonChildData子按钮数据(请按钮demo上的数据格式填写)Array
right距离窗口右边的距离(单位:rpx)Number100
bottom距离窗口底部的距离(单位:rpx)Number100
2.方法
方法名参数描述
open打开button
close关闭button

开发

可以看官方的文档

参考资料

react-motion-menu-button

Keywords

FAQs

Last updated on 22 May 2019

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc