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 🙏

© 2026 – Pkg Stats / Ryan Hefner

xt-captcha

v0.1.23

Published

验证码服务

Readme

xt-captcha

验证码服务

安装

npm install xt-captcha

模式

共有三种验证方式,滑动拼图、文字验证、和旋转验证。通过 mode 参数来设置,默认不传为滑动。mode 参数详情见下边说明。

使用方法

umd 方式

<script src="https://app.litenews.cn/service2/public/js/captcha/index.js"></script>

<script>
const captcha = createCaptcha({
      // 验证回调
      onVerify({
        error,
        result
      }) {
        // 验证失败 不需要其他额外处理,内部做了失败刷新处理
        if (error) {}
        // 验证成功
        if (result) {
          // result.data 返回为验证成功后的凭证
        }
      },
      // 关闭弹窗的回调
      onClose(close) {
        // close 为字符串 'close'
      }
    })
    captcha.open()
</script>

esm 方式 vue 项目中使用

  • vue2 中使用
<script>
import { createCaptcha } from 'xt-captcha'

export default {
  name: 'App',
  data() {
    return {
      captcha: null
    }
  },
  mounted() {
    this.initCaptcha()
  },
  methods: {
    initCaptcha() {
      this.captcha = createCaptcha({
        // 验证回调
        onVerify({ error, result }) {
          // 验证失败 不需要其他额外处理,内部做了失败刷新处理
          if (error) {
          }
          // 验证成功
          if (result) {
            // result.data 返回为验证成功后的凭证
          }
        },
        // 关闭弹窗的回调
        onClose(close) {
          // close 为字符串 'close'
        }
      })

      // 显示验证弹窗
      this.captcha.open()
    }
  }
}
</script>
  • vue3 中使用
<scripte setup lang="ts">
import { createCaptcha } from 'xt-captcha'
import { ref, onMounted } from 'vue'

const captcha = ref(null)

onMounted(() => {
  captcha.value = createCaptcha({
    // 验证回调
    onVerify({ error, result }) {
      // 验证失败 不需要其他额外处理,内部做了失败刷新处理
      if (error) {
      }
      // 验证成功
      if (result) {
        // result.data 返回为验证成功后的凭证
      }
    },
    // 关闭弹窗的回调
    onClose(close) {
      // close 为字符串 'close'
    }
  })

  captcha.value.open()
})
</scripte>

Api

props

| 参数 | 说明 | 类型 | 默认值 | | -------- | ------------ | ----------------------------------------------------------- | ---------------- | | mode | 验证形式 | 滑动验证'slide',或文字点选'text','rotate'为旋转 | slide | | appid | appid | string | 默认为空,非必填 | | onVerify | 验证回调 | (arg: { error?: string, result?: { data: string }}) => void | | | onClose | 关闭弹窗回调 | (arg: string) => void | |

api

| 方法名 | 说明 | | | ------ | -------- | --- | | open | 显示弹窗 | | | close | 关闭弹窗 | |