Pulled ALL skills from 15 source repositories: - anthropics/skills: 16 (docs, design, MCP, testing) - obra/superpowers: 14 (TDD, debugging, agents, planning) - coreyhaines31/marketingskills: 25 (marketing, CRO, SEO, growth) - better-auth/skills: 5 (auth patterns) - vercel-labs/agent-skills: 5 (React, design, Vercel) - antfu/skills: 16 (Vue, Vite, Vitest, pnpm, Turborepo) - Plus 13 individual skills from various repos Mosaic Stack is not limited to coding — the Orchestrator and subagents serve coding, business, design, marketing, writing, logistics, analysis, and more. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
71 lines
1.8 KiB
Markdown
71 lines
1.8 KiB
Markdown
---
|
|
category: '@Integrations'
|
|
---
|
|
|
|
# useAsyncValidator
|
|
|
|
Wrapper for [`async-validator`](https://github.com/yiminghe/async-validator).
|
|
|
|
## Install
|
|
|
|
```bash
|
|
npm i async-validator@^4
|
|
```
|
|
|
|
## Usage
|
|
|
|
```ts
|
|
import { useAsyncValidator } from '@vueuse/integrations/useAsyncValidator'
|
|
```
|
|
|
|
## Type Declarations
|
|
|
|
```ts
|
|
export type AsyncValidatorError = Error & {
|
|
errors: ValidateError[]
|
|
fields: Record<string, ValidateError[]>
|
|
}
|
|
export interface UseAsyncValidatorExecuteReturn {
|
|
pass: boolean
|
|
errors: AsyncValidatorError["errors"] | undefined
|
|
errorInfo: AsyncValidatorError | null
|
|
errorFields: AsyncValidatorError["fields"] | undefined
|
|
}
|
|
export interface UseAsyncValidatorReturn {
|
|
pass: ShallowRef<boolean>
|
|
isFinished: ShallowRef<boolean>
|
|
errors: ComputedRef<AsyncValidatorError["errors"] | undefined>
|
|
errorInfo: ShallowRef<AsyncValidatorError | null>
|
|
errorFields: ComputedRef<AsyncValidatorError["fields"] | undefined>
|
|
execute: () => Promise<UseAsyncValidatorExecuteReturn>
|
|
}
|
|
export interface UseAsyncValidatorOptions {
|
|
/**
|
|
* @see https://github.com/yiminghe/async-validator#options
|
|
*/
|
|
validateOption?: ValidateOption
|
|
/**
|
|
* The validation will be triggered right away for the first time.
|
|
* Only works when `manual` is not set to true.
|
|
*
|
|
* @default true
|
|
*/
|
|
immediate?: boolean
|
|
/**
|
|
* If set to true, the validation will not be triggered automatically.
|
|
*/
|
|
manual?: boolean
|
|
}
|
|
/**
|
|
* Wrapper for async-validator.
|
|
*
|
|
* @see https://vueuse.org/useAsyncValidator
|
|
* @see https://github.com/yiminghe/async-validator
|
|
*/
|
|
export declare function useAsyncValidator(
|
|
value: MaybeRefOrGetter<Record<string, any>>,
|
|
rules: MaybeRefOrGetter<Rules>,
|
|
options?: UseAsyncValidatorOptions,
|
|
): UseAsyncValidatorReturn & PromiseLike<UseAsyncValidatorReturn>
|
|
```
|