vue3-geetest
TypeScript icon, indicating that this package has built-in type declarations

1.0.19 • Public • Published

Vue3 Geetest

安装

使用 npm 安装:

npm install vue3-geetest

使用

首先在 main.ts 中引入并注册组件:

import {Geetest} from 'vue3-geetest'

app.use(Geetest, {
    captchaId: 'xxx'
})

然后在可直接在 vue 模板中使用:

<template>
  <GeetestCaptcha :config="config" @initialized="getCaptcha" />
</template>

<script setup lang="ts">
import {GeetestCaptcha} from 'vue3-geetest'
import type {CaptchaConfig} from 'vue3-geetest'

const config: CaptchaConfig = {
  product: 'popup',
  nativeButton: {
    width: '100%',
    height: '50px'
  }
}

const getCaptcha = (instance: any) => {
  instance
    .onReady(function () {
      console.log('ready')
    })
    .onNextReady(function () {
      console.log('nextReady')
    })
    .onBoxShow(function () {
      console.log('boxShow')
    })
    .onError(function (e: any) {
      console.log(e)
    })
    .onSuccess(function () {
      console.log('success')
    })
}
</script>

instance 为极验实例对象,具体 API 方法可参考极验文档

Readme

Keywords

Package Sidebar

Install

npm i vue3-geetest

Weekly Downloads

27

Version

1.0.19

License

WTFPL

Unpacked Size

6.78 kB

Total Files

8

Last publish

Collaborators

  • devhaozi