@carpenter/react-tencent-captcha

腾讯验证码 react 组件

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
@carpenter/react-tencent-captcha
200.1.33 years ago3 years agoMinified + gzip package size for @carpenter/react-tencent-captcha in KB

Readme

@carpenter/react-tencent-captcha

安装

npm i @carpenter/react-tencent-captcha

引用

import TencentCaptcha from '@carpenter/react-tencent-captcha';

属性

| 成员 | 说明 | 类型 | 默认值 | |------------|-----------------|--------------------|--------------| | onRefChild | onRefChild | function | 无 | | appid | appid | String | 无 | | callback | 验证成功的回调函数 | function | 无 | | options | 配置参数 | object | 无 |

示例

import TencentCaptcha from '@carpenter/react-tencent-captcha';

class Demo extends Component {

  captcha = null;

  onRefChild = ref => {
    this.captcha = ref;
  }

  captchaCallback = res => {
    console.log(res);
  }

  // 销毁
  destroy = () => {
    this.captcha.destroy();
  }

  render() {
    return <div>
      <TencentCaptcha
        appid="2028109764"
        callback={this.captchaCallback}
        onRefChild={this.onRefChild}
      >
        点我啊!
      </TencentCaptcha>
    </div>
  }
}