Vue Dog Form is a lightweight (under 3kb gzipped) and flexible form validation plugin designed exclusively for Vue 3 applications. Its current stable version is 3.0.0. It differentiates itself by avoiding schema objects, instead utilizing native HTML-like validation attributes directly on its `<DError>` component, making validation declarations intuitive and co-located with the input. The plugin is compatible with any custom input components and supports custom validation rules and messages. Version 3.0.0 introduced full TypeScript support, an auto-revalidate feature for custom rules, and disabled the browser's native form validation by default, streamlining the developer experience. The release cadence appears to be feature-driven, with significant rewrites in major versions like v2 (Composition API) and v3 (TypeScript and default behavior changes).
npm install vue-dog-formVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to install Vue Dog Form as a Vue plugin, wrap a form with <DForm>, and use <DError> components for declarative validation with `v-model` and native-like attributes. It includes a basic submit handler with TypeScript typing.
To re-enable native validation, add `native-validate="true"` to your `<DForm>` component: `<DForm native-validate="true" @submit="submitHandler">`.
Add CSS rules for the `._df_ErrMsg` class (e.g., `._df_ErrMsg { color: red; font-size: 0.8em; margin-top: 5px; }`) in your component styles or global stylesheet.Review any custom logic interacting with the plugin's internals if upgrading from v1.x. The primary public API usage remains the same, but internal access patterns would need adjustment.
Remove any explicit `e.preventDefault()` calls from your `<DForm>` submit handlers. Focus solely on your validation and data processing logic.
Ensure you have `import dogForm from 'vue-dog-form'` and `app.use(dogForm)` in your `main.js` or Nuxt plugin file.
Verify that `app.use(dogForm)` is executed before mounting your Vue application. For Nuxt 3, ensure the plugin file is correctly set up in the `plugins` directory and exports `defineNuxtPlugin`.
Import `DogSubmitEvent` and type your event parameter: `import type { DogSubmitEvent } from 'vue-dog-form'; const submitHandler = (e: DogSubmitEvent) => { ... }`.No dependency data recorded yet.