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

hyf_send_code

v1.2.1

Published

本项目基于vue3.0开发的发送验证码功能组件,开发者不在需要关注发送后倒计时的逻辑,只需要关注发送接口就可以了。 # 安装方法 > 1, npm install hyf_send_code # 使用方法 ### 第一种:main.js中使用 ``` <!-- 例子是:vite搭建的3.0版本的 --> import { createApp } from 'vue' import App from './App.vue' import './index.css' import sen

Downloads

11

Readme

项目介绍

本项目基于vue3.0开发的发送验证码功能组件,开发者不在需要关注发送后倒计时的逻辑,只需要关注发送接口就可以了。

安装方法

1, npm install hyf_send_code

使用方法

第一种:main.js中使用

<!-- 例子是:vite搭建的3.0版本的 -->
import { createApp } from 'vue'
import App from './App.vue'
import './index.css'
import sendCode from 'hyf_send_code'
const app = createApp(App);
app.use(sendCode);
app.mount('#app');

然后就可以全局使用了。

第二种:各个组件内的使用

<script setup>
import verificationCode from 'hyf_send_code';
<template>
  <verificationCode></verificationCode>
</template>
</script>

第三种:详细的使用,放个例子:入参以及暴露出来的方法

第一个例子是全局引入的例子也就是app.use();结合上边的main.js中的使用

<script setup>
let send_code_params = {
  button_text: "发送验证码", //这是按钮展示文字,因为后期会变为秒数,所以需要button_prepare_text
  button_prepare_text: "发送验证码", //在变为倒计时之后需要再变回原来的文字
  send_timer_coundown: 10, //倒计时
  selfHeight: '200px', //高度
  selfWidth: '200px', //宽度
  selfColor: '#fff', //字体颜色
  selfBgColor: '#07c160', //背景颜色
  selfBorderColor: '#07c160', //边框颜色
  selfSize: '14px', //边框颜色
  selfBradius: '6px', //边框圆角

}
</script>
<template>
  <div>
    <sendCode
      :public_button_params="send_code_params"
      @interfance_code_send="interfance_children_send"
    ></sendCode>
  </div>
</template>

<script>
export default {
  name: 'App',
  methods: {
      //发送验证码点击事件,在这个方法内调用发送接口
    interfance_children_send() {
      console.log('验证码发送成功');
    }
  }
}
</script>

第二个例子是按需引入的例子;

<script setup>
//这里就是按需引入的路径
import HelloWorld from 'hyf_send_code/src/pages/studyDemo/index';
import sendCode from 'hyf_send_code/src/pages/sendMessage/index';
let message = "你过得好吗";
let send_code_params = {
  button_text: "发送验证码", //这是按钮展示文字,因为后期会变为秒数,所以需要button_prepare_text
  button_prepare_text: "发送验证码", //在变为倒计时之后需要再变回原来的文字
  send_timer_coundown: 10, //倒计时
  selfHeight: '200px', //高度
  selfWidth: '200px', //宽度
  selfColor: '#fff', //字体颜色
  selfBgColor: '#07c160', //背景颜色
  selfBorderColor: '#07c160', //边框颜色
  selfSize: '14px', //边框颜色
  selfBradius: '6px', //边框圆角

}
</script>

<template>
  <div class="test-npm">
    <div>{{ message }}</div>
    <sendCode
      :public_button_params="send_code_params"
      @interfance_code_send="interfance_children_send"
    ></sendCode>
    <HelloWorld msg="自定义组件测试" />
  </div>
</template>
<script>
 export default{
   data(){
     return{

     }
   },
   methods:{
     interfance_children_send(){
       console.log('验证码发送成功');
     }
   }
 }
</script>

第四步:本步详细介绍参数

|参数|描述|默认值| |:-|:-:|-:| |send_timer_coundown|倒计时时长|60s| |selfHeight|按钮高度|40px| |selfWidth|按钮宽度|200px| |selfColor|字体颜色|#fff| |selfBgColor|按钮背景颜色|#1989fa| |selfBorderColor|按钮边框颜色|#1989fa| |selfSize|按钮字体大小|14px| |selfBradius|边框圆角|6px| |button_text|按钮展示文字|发送验证码| |button_prepare_text|按钮展示文字(必传)|发送验证码|

第五步:按钮事件

|事件名|描述| |:-|:-:| |interfance_code_send|点击发送按钮的事件|

第六步:特别注意

本组件就跟vant,element等的组件库按需加载一个意思,应为组件内的名字是我给定的,所以当你在main.js中无论你取名为啥,最后再使用时都需要使用我注册的名字,就跟vant一样的原理。 所以本次组件我注册了两个

|组件名|描述| |:-|:-:| |sendCode|发送验证码组件| |HelloWorld|就是一个标题,是我练习注册组件的demo|