Launch Week Day 2: Introducing Reports: An Extensible Reporting Framework for Socket Data.Learn More
Socket
Book a DemoSign in
Socket

@yidun/alipay-ne-captcha

Package Overview
Dependencies
Maintainers
6
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@yidun/alipay-ne-captcha

neCaptcha component for alipay miniprogram

latest
npmnpm
Version
1.0.2
Version published
Maintainers
6
Created
Source

支付宝小程序

引入

在根目录执行下述命令,https://opendocs.alipay.com/mini/ide/npm-manage

  npm install @yidun/alipay-ne-captcha

在页面或组件的 json 文件中声明引组件

{ "usingComponents": { "ne-captcha": "path-to-component/ne-captcha/index" } } 注意:在支付宝小程序开发者工具中,请务必在详情-项目配置下,勾选启用component2编译。

使用

<view>
  <ne-captcha
    ref="saveCaptchaRef"
    captchaId="CAPTCHA_ID"
    width="320rpx"
    onError="handlerError"></ne-captcha>
  <view>
    <button onTap="handleOpenCaptcha">点击验证</button>
  </view>
</view>
Page({
  saveCaptchaRef (ref) {
    this.captchaRef = ref
  },
  handlerError (error) {},
  handleOpenCaptcha () {
    this.captchaRef.popup()
  }
})

配置项

可配项类型默认值描述
captchaIdString验证码ID
langString'zh-CN'语言
widthString'auto'验证码弹框宽度,接受单位'rpx'/'px'/'rem'/'%'
customStylesObjectnull自定义验证码样式,详情查看下面
注意: 小程序的超时设置可在 app.json 全局配置

customStyles

  • imagePanel
    • borderRadius(String): imagePanel的圆角大小
  • controlBar
    • borderRadius(String): controlBar的圆角大小
    • height(String): controlBar的高度
    • gap: imagePanel和controlBar的间隔
  • popTitle
    • height(String): 弹框头部高度
    • popPadding(String): 弹框体内边距

事件

事件名参数描述
onError验证码配置失败
onInit验证码配置成功(初始化)
onReady验证码准备就绪
onVerifyerr, validate 验证码验证完成
onClose验证码弹框准备关闭

组件方法

  • popup: 展示验证码(支持非智能无感知验证码调用此方法)
  • verify: 展示验证码(仅支持智能无感知验证码调用此方法)
  • reset: 重置验证码,获取新的验证信息

域名

  • 服务器域名:c.dun.163yun.com、c.dun.163.com
  • 图片域名:necaptcha.nosdn.127.net、nos.netease.com

FAQs

Package last updated on 07 Feb 2021

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