--- title: Vue SDK --- # Vue SDK Official Vue 3 component for CaptchaLa CAPTCHA — published as [`@captcha-la/vue`](https://www.npmjs.com/package/@captcha-la/vue). ## Live demo ::: tip 📦 [demo-v1.captcha.la/vue](https://demo-v1.captcha.la/vue/) — runnable demo with all four product modes. Source: [Captcha-La/vue-example](https://github.com/Captcha-La/vue-example). ::: ## Install ```bash npm install @captcha-la/vue # or yarn add @captcha-la/vue # or pnpm add @captcha-la/vue ``` Peer dependency: `vue@^3.2.0`. ## Quick start ```vue ``` ## Props | Prop | Type | Default | Description | |------|------|---------|-------------| | `appKey` | `string` | *required* | CaptchaLa application key | | `serverToken` | `string` | - | One-time, server-issued challenge token. Required when the app has `server_token_required=true`. | | `product` | `'popup' \| 'float' \| 'embed' \| 'bind'` | `'popup'` | Display mode | | `action` | `string` | `'default'` | Action identifier (e.g. `login`, `register`, `checkout`) | | `lang` | `string` | `'zh-CN'` | Language code (`zh-CN`, `en`, `ja`, …) | | `bindTo` | `string \| HTMLElement` | - | Element selector or node to bind to (only for `product="bind"`) | ## Events | Event | Payload | Description | |-------|---------|-------------| | `success` | `{ token, type, action }` | Verification succeeded | | `error` | `error` | Verification failed | | `close` | — | CAPTCHA closed | | `ready` | — | CAPTCHA ready | ## Methods (via `ref`) ```vue ``` | Method | Description | |--------|-------------| | `verify()` | Trigger verification | | `reset()` | Reset CAPTCHA state | | `destroy()` | Destroy the instance | | `bindTo(selector)` | Bind to element (for `bind` mode) | | `setLang(lang)` | Switch language in place | ## Production: `serverToken` mode For high-value flows (login, register, payment) we recommend the **server-issued token flow**. Your backend mints a one-time `server_token` (5-minute TTL) via `POST /v1/server/challenge/issue` and hands it to the browser: ```vue ``` See [API Reference](/api-reference) for the full backend contract. ## Links - [npm](https://www.npmjs.com/package/@captcha-la/vue) · [GitHub](https://github.com/Captcha-La/vue) · [example](https://github.com/Captcha-La/vue-example) - [Web SDK overview](/web-sdk) · [API Reference](/api-reference)