logo文件
搜尋
登錄

API 指南

onReady(definition)

驗證碼完成初始化且所需資源加載完畢觸發

參數

  • { Function } definition

用法

initGeetest({...},function(gt){ gt.onReady(function(){...})})
              
              initGeetest({...},function(gt){
    gt.onReady(function(){...})})

            
此代碼塊在浮窗中顯示

onShow(definition)

驗證窗顯示時觸發

參數

  • { Function } definition

用法

initGeetest({...},function(gt){ gt.onShow(function(res){...})})
              
              initGeetest({...},function(gt){
    gt.onShow(function(res){...})})

            
此代碼塊在浮窗中顯示

onClose(definition)

驗證窗隱藏時觸發

參數

  • { Function } definition

用法

initGeetest({...},function(gt){ gt.onClose(function(){...})})
              
              initGeetest({...},function(gt){
    gt.onClose(function(){...})})

            
此代碼塊在浮窗中顯示

onSuccess(definition)

驗證成功觸發

參數

  • { Function } definition

用法

initGeetest({...},function(gt){ gt.onSuccess(function(res){// 驗證成功的結果 console.log(res)...})})
              
              initGeetest({...},function(gt){
    gt.onSuccess(function(res){// 驗證成功的結果
        console.log(res)...})})

            
此代碼塊在浮窗中顯示

onFail(definition)

驗證失敗觸發

參數

  • { Function } definition

用法

initGeetest({...},function(gt){ gt.onFail(function(res){// 驗證失敗的結果 console.log(res)...})})
              
              initGeetest({...},function(gt){
    gt.onFail(function(res){// 驗證失敗的結果
        console.log(res)...})})

            
此代碼塊在浮窗中顯示

onError(definition)

驗證錯誤觸發

參數

  • { Function } definition

用法

initGeetest({...},function(gt){ gt.onError(function(err){// 驗證錯誤的結果 console.log(err)...})})
              
              initGeetest({...},function(gt){
    gt.onError(function(err){// 驗證錯誤的結果
        console.log(err)...})})

            
此代碼塊在浮窗中顯示

appendTo(options)

用於將喚醒驗證窗的內置按鈕掛載到指定位置。 opions接收 id或class選擇器,也可以是完整的dom。配置參數product值不為bind時生效。

參數

  • { Object|String } options

用法

initGeetest({...},function(gt){ gt.onReady(function(){// 將內置按鈕添加到指定元素的結尾// 支持以下三種方式// 示例 <div id="captcha_wrap" class="captcha-wrap"></div> gt.appendTo('#captcha_wrap') gt.appendTo('.captcha-wrap') gt.appendTo(document.getElementById('captcha_wrap'))})})
              
              initGeetest({...},function(gt){
    gt.onReady(function(){// 將內置按鈕添加到指定元素的結尾// 支持以下三種方式// 示例 <div id="captcha_wrap" class="captcha-wrap"></div>
        gt.appendTo('#captcha_wrap')
        gt.appendTo('.captcha-wrap')
        gt.appendTo(document.getElementById('captcha_wrap'))})})

            
此代碼塊在浮窗中顯示

showCaptcha()

驗證碼初始化完成後,可喚醒驗證窗。內置按鈕事件會觸發喚醒驗證窗。配置參數product值為bind時生效。

用法

initGeetest({...},function(gt){ gt.onReady(function(){// 通過showCaptcha自定義喚醒驗證窗// 示例驗證準備完畢立即喚醒 gt.showCaptcha()})})
              
              initGeetest({...},function(gt){
    gt.onReady(function(){// 通過showCaptcha自定義喚醒驗證窗// 示例驗證準備完畢立即喚醒
        gt.showCaptcha()})})

            
此代碼塊在浮窗中顯示

reset()

重置驗證碼, 僅當驗證成功或發生錯誤時生效

用法

initGeetest({...},function(gt){ gt.onError(function(){... gt.reset()}) gt.onSuccess(function(){... gt.reset()})})
              
              initGeetest({...},function(gt){
    gt.onError(function(){...
      gt.reset()})

    gt.onSuccess(function(){...
      gt.reset()})})

            
此代碼塊在浮窗中顯示

destroy()

銷毀驗證碼

用法

initGeetest({...},function(gt){ gt.onSuccess(function(){... gt.destroy()})})
              
              initGeetest({...},function(gt){
    gt.onSuccess(function(){...

      gt.destroy()})})

            
此代碼塊在浮窗中顯示
icon
聯繫銷售