Mini-program Integration Guide
This guide details how to integrate captcha-pro across various mini-program platforms.
📋 Table of Contents
- WeChat Mini-program
- Taro Framework
- uni-app Framework
- Domain Configuration
- HTTPS Requirements
- Debugging Tips
WeChat Mini-program
Installation
bash
pnpm add @captcha-pro/weixinUsing the Slider Captcha
WXML:
xml
<view class="container">
<captcha-slider
width="{{300}}"
height="{{170}}"
precision="{{5}}"
bind:success="onSuccess"
bind:fail="onFail"
/>
</view>JS:
javascript
Page({
data: {
width: 300,
height: 170,
precision: 5
},
onSuccess() {
console.log('Passed!')
},
onFail() {
console.log('Failed!')
}
})Taro Framework
React Version
bash
pnpm add @captcha-pro/taro-reacttsx
import { SliderCaptcha } from '@captcha-pro/taro-react'
export default function Index() {
const handleSuccess = () => {
console.log('Passed!')
}
return (
<SliderCaptcha
width={300}
height={170}
onSuccess={handleSuccess}
/>
)
}uni-app Framework
bash
pnpm add @captcha-pro/uniapp-vuevue
<template>
<view>
<SliderCaptcha
:width="300"
:height="170"
@success="onSuccess"
/>
</view>
</template>
<script setup>
import { SliderCaptcha } from '@captcha-pro/uniapp-vue'
const onSuccess = () => {
console.log('Passed!')
}
</script>Domain Configuration
Configure the legitimate domain in the WeChat Official Account platform:
- Log in to the WeChat Official Account platform
- Development Management → Development Settings → Server Domain
- Add
https://your-domain.com
HTTPS Requirements
Certificate Requirements
- Must be a valid SSL certificate
- Self-signed certificates are not supported
- Must support TLS 1.2+
Debugging Tips
Development Environment
In the WeChat Developer Tools:
Settings → Project Settings → Do not verify legitimate domains
⚠️ Production environments must configure legitimate domains.