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

timer-btn

v1.1.1

Published

限制点击时间的按钮,可用于短信验证码等场景,相关样式持续更新中

Downloads

2

Readme

限制点击时间的按钮,可用于短信验证码等场景,相关样式持续更新中。

特点

  • 没有依赖包(但仅支持Vue2版本以上)
  • 可以设定等待时间
  • 可以手动打断
  • 可以手动触发

实例


安装 及 使用

$ npm install --save timer-btn

注册组件

import Vue from 'vue'
import timerBtn from 'timer-btn'

Vue.component('timerBtn', timerBtn)

使用组件

<template>
    //按钮的样式根据您所选用的ui框架选择class
    <timer-btn class="ivu-btn ivu-btn-default" v-on:beforeStart="sendCode()"
                               v-on:end="endTime" :second="30" textBeforeClick="发送验证码" textAfterClick="秒后重新获取"></timer-btn>
</template>

<script>
export default {
  //发送验证码
  sendCode () {
    //检查form
    //确认执行发送逻辑
    if (true) {
      console.log('您点击了按钮,按钮将会在您指定的时间之内不可用,并显示倒计时');
      timerBtn.start();
    } else {
      // your logic
    }

  },
  //验证码按钮的等待时间结束
  end () {
    console.log('end');
  }
}
</script>

参数

second

类型: Number 必要性: false 默认值: 60

定义按钮点击后,所需要等待的时间,单位秒

disabled

类型: Boolean 必要性: false 默认值: false

按钮点击后,处于disabled状态,此时按钮不可点击

textBeforeClick

类型: String 必要性: false 默认值: 获取验证码

按钮点击之前显示的文本

textAfterClick

类型: String 必要性: false 默认值: s 后重新获取

按钮点击之后显示的文本,second的倒计时会在文本最前面显示,所以一般会加一个"秒"或者"s"

后续计划

  • 添加更cool的倒计时样式

  • 添加更完善的响应事件