Validation rules for vue-formily.
You can use validation rules with a script tag and a CDN, import the library like this:
<script src="https://unpkg.com/@vue-formily/rules@latest"></script>
This will inject a Rules
global object, which you will use to access the various rules.
If you are using native ES Modules, there is also an ES Modules compatible build:
<script type="module">
import rules from 'https://unpkg.com/@vue-formily/rules@latest/dist/rules.esm.js'
</script>
# install with yarn
yarn add @vue-formily/rules
# install with npm
npm install @vue-formily/rules --save
import { required, email } from '@vue-formily/rules';
const formSchema = {
formId: 'login',
fields: [
{
formId: 'email',
rules: [
required,
email
]
},
]
};
// Use the schema in Vue instance
// ...
You are welcome to contribute to this project, but before you do, please make sure you read the Contributing Guide.