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

miniprogram-sms-code

v1.0.3

Published

微信小程序短信验证码输入

Downloads

9

Readme

sms-code

仿京东淘宝6位验证码输入

本组件兼容暂未发现兼容问题,适用微信低版本基础库

效果演示

密码模式

密码模式演示

短信验证码模式

短信验证码模式演示

使用方法

1.安装sms-code

开启微信的npm构建 文档 然后安装

npm install --save miniprogram-sms-code

2.在需要使用 sms-code 的页面 .json 中添加 sms-code 自定义组件配置

{
  "usingComponents": {
    "sms-code": "miniprogram-sms-code"
  }
}

3.在需要使用 sms-code 的页面 .wxml 中引用 sms-code

<sms-code
  unactive-class="sms-unActive"
  active-class="sms-active"
  code-type="number"
  code-count="6"
  is-auto="{{ isAuto }}"
  bindchangeCode="changeCode">
</sms-code>

组件属性

1.属性

| 属性名 | 类型 | 默认值 | 是否必须 | 说明 | |-------------------------|--------------|---------------------------|------------|---------------------------------------------| | code-type | String | number | 否 | 组件类型,可取值:password(密码类型),number(数字类型),text(文本类型)| | | code-count | Number | 6 | 否 | 可输入长度,验证码或密码的长度 | | is-auto | Boolean | false | 否 | 是否自动获取焦点 | | unactive-class | String | 无 | 否 | 输入块未输入时和失去焦点的样式类名,用于自定义样式| | active-class | String | 无 | 否 | 输入块有值时和获得焦点时的样式列名,用于自定义样式| | dot-class | String | 无 | 否 | 输入块密码状态样式,用于自定义样式|

2.方法

| 方法名 | 是否必须 | 返回值 | 说明 | |-------------------------|------------- |---------------------------|---------------------------------------------| | bindchangeCode | 是 |e,输入框的值 e.detail.value| 监听输入值的变化 |

栗子

覆盖默认样式

1.在引用组件的页面.wxml中,设置unactive-class 和 active-class

<view class="test">
  <sms-code unactive-class="sms-unActive" active-class="sms-active"  bindchangeCode="changeCode"></sms-code>
</view>

2.在引用组件的页面.wxss中,编写自己的样式代码

/*自定义组件样式*/
.test .sms-unActive{
  border-color: green;
}

.test .sms-active{
  border-color: gold;
}

3.效果

覆盖组件默认样式 覆盖组件默认样式