npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@mas.io/mas-verify-sms

v1.1.2

Published

@alipay/mas-verify-sms 的组件描述

Downloads

3

Readme

安装

tnpm install --save @alipay/mas-verify-sms

组件介绍

行业小程序短信验证码组件

参数说明

属性 | 必填 | 参数类型 | 参数说明 | 默认值 | 示例 --|:--:|:--:|:--:|:--: | :-: className | 否 | string | 模块类名 | '' | 'custom' title | 否 | string | 标题 | '' | '输入验证码' verifyCodeLength | 否 | number | 验证码长度 4或者6 | 4 | 6 codeTime | 否 | number | 验证码倒计时 | 60 | 30 verifyCodeErrorMsg | 否 | string | 验证码错误提示,变更内容会初始化倒计时 | '' | '验证码错误' hasInitSendCode | 否 | boolean | 初始化时是否已发送验证码 | false | true focus | 否 | boolean | 是否在焦点上,原生键盘不支持唤起键盘 | false | true keyboardType | 是 | string | 键盘类型,默认default 原生键盘 | 'default' | 'custom' completedAndSubmit | 是 | boolean | 是否输入完成同时触发onSubmitCode方法, 并隐藏确认按钮, 默认false | false | true onCompleteCode | 否 | (value: string) => void | 验证码输入完成事件 | '' | onSendCode | 否 | () => void; | 点击发送/重新发送验证码时触发 | '' | onSubmitCode | 否 | (value: string) => void | 点击确认 | '' | onChangeCustomKeyBoard | 否 | (show: boolean) => void | 自定义键盘唤起事件 | '' |

特别说明

该组件监听了页面中的 `onMasReset` 方法,用于重置倒计时状态
Page({
  ...
  onLoad(){
    this.onMasReset()
  },
  /** 用于触发组件重置 */
  onMasReset() {}
})

在小程序中使用

{
  "usingComponents": {
    "mas-xxxx": "@alipay/mas-verify-sms/es/index"
  }
}

在 page.axml 中引用组件

 <mas-verify-sms
    title="输入验证码"
    codeTime="{{ 10 }}"
    verifyCodeLength="{{ 4 }}"
    verifyCodeErrorMsg="{{ verifyCodeErrorMsg }}"
    onSendCode="sendVerifyCode"
    onSubmitCode="handleSubmitCode"
    focus="{{true}}"
    keyboardType="default"
    completedAndSubmit="{{ true }}"
  >
  <view class="verify-sms-info" slot="titleBottom">
    <view class="verify-sms-subTitle">我们已向所选油卡的预留手机号
      <text class="verify-sms-mobile">187****2286</text>
    </view>
    <view class="verify-sms-subTitle">发送验证码短信,请查看短信输入验证码 </view>
  </view>
</mas-verify-sms>

在 page/index.acss 中引入字体图标

.page-container {
  position: fixed;
  right: 0;
  left: 0;
  top: 0;
}
.verify-sms-info {
  margin-top: 18rpx;
}
.verify-sms-subTitle {
  font-family: PingFangSC-Regular;
  font-size: 28rpx;
  color: #666666;
  line-height: 42rpx;
}

.verify-sms-mobile {
  color: #1677FF
}

page/index.js

Page({
  data: {
    verifyCodeErrorMsg: '',
  },
  onLoad() {},

  /**
   * 发送验证码
   */
  sendVerifyCode() {
    this.setData({
      verifyCodeErrorMsg: '',
    });
    // 调接口
  },

  /**
   * 得到验证码
   * @param {*} value
   */
  handleSubmitCode(value) {
    console.log(value, 'handleSubmitCode');
    my.showLoading({
      content: '加载中...',
      delay: '1000',
    });
    // 接口调用
    setTimeout(() => {
      this.setData({
        verifyCodeErrorMsg: '验证码错误,请重新输入',
      });
      my.hideLoading();
    }, 2000);
  },
});

Badges

TNPM version TNPM downloads [![install size][install-size-image]][install-size-url]