Product
Introducing License Enforcement in Socket
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
@vue-use-form/class-validator
Advanced tools
# npm
npm i @vue-use-form/class-validator
# yarn
yarn add @vue-use-form/class-validator
#pnpm
pnpm i @vue-use-form/class-validator
⚠️ Remember to add these options to your
tsconfig.json
!
"strictPropertyInitialization": false,
"experimentalDecorators": true
<script lang="ts" setup>
import { IsString, Length, IsEmail } from 'class-validator'
import { useClassValidator } from '@vue-use-form/class-validator'
import { useForm } from 'vue-use-form'
class LoginForm {
@IsString()
@Length(3, 10)
username: string
@IsEmail()
email: string
}
const resolver = useClassValidator()
const { register, createSubmitHandler, createErrorHandler } = useForm<LoginForm>({
resolver,
mode: 'onChange',
})
const [usernameField] = register('username')
const [emailField] = register('email')
const onSubmit = createSubmitHandler((data) => {
console.log(data)
})
const onError = createErrorHandler((errors) => {
console.log(errors)
})
</script>
<template>
<form @submit.prevent="handleSubmit(onSubmit, onError)()">
<input v-model="usernameField" />
<input v-model="emailField" />
</form>
</template>
FAQs
class-validator resolver for vue-use-form
The npm package @vue-use-form/class-validator receives a total of 3 weekly downloads. As such, @vue-use-form/class-validator popularity was classified as not popular.
We found that @vue-use-form/class-validator demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
Product
We're launching a new set of license analysis and compliance features for analyzing, managing, and complying with licenses across a range of supported languages and ecosystems.
Product
We're excited to introduce Socket Optimize, a powerful CLI command to secure open source dependencies with tested, optimized package overrides.