Skip to content

Commit

Permalink
docs: fix broken links in the intro
Browse files Browse the repository at this point in the history
  • Loading branch information
logaretm committed Sep 4, 2019
1 parent fd634fb commit 4aff7da
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
13 changes: 7 additions & 6 deletions docs/guide/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
prev: false
next: ./getting-started.md
---

# Introduction

VeeValidate is a template-based validation library for Vue.js. It has plenty of validation rules out of the box and support for custom ones as well. It is template based so it is easy and familiar.
Expand All @@ -11,9 +12,9 @@ VeeValidate is a template-based validation library for Vue.js. It has plenty of
- Template based validation.
- Written in TypeScript.
- Validates HTML5 inputs and custom Vue components.
- [Many validation rules are provided out of the box](./rules.md).
- [Many validation rules are provided out of the box](../api/rules.md).
- [Localization Support](./localization.md) with 40+ locales available.
- [Custom Rules](./custom-rules.md) support.
- [Custom Rules](./basic-validation.md) support.
- No dependencies.

## Why Template based validation
Expand All @@ -23,23 +24,23 @@ There are two ways to tackle form validation, declarative and imperative. When t
Both approaches has their pros and cons, but the declarative style has been rooted in the HTML spec as it feels more natural, for example:

```html
<input type="text" required>
<input type="text" required />
```

Clearly communicates that the input is required with minimal effort. Compared to a traditional imperative code:

```html
<input oninput="updateValue" type="text">
<input oninput="updateValue" type="text" />
```

```js
let value = '';

function checkRequired (value) {
function checkRequired(value) {
return value.trim().length > 0;
}

function updateValue (e) {
function updateValue(e) {
value = e.target.value;
checkRequired(value);
}
Expand Down
9 changes: 4 additions & 5 deletions docs/guide/basic-validation.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ We will need to [add an exception](https://nuxtjs.org/api/configuration-build/#t

:::


## Rules Parameters

Rule functions can also accept params to configure their behavior.
Expand All @@ -52,7 +51,7 @@ import { extend } from 'vee-validate';

extend('required', {
params: ['max'], // list of parameter names
validate (value, { max }) {
validate(value, { max }) {
return Number(value) > max;
}
});
Expand Down Expand Up @@ -80,7 +79,7 @@ import { extend } from 'vee-validate';

extend('required', {
validate: value => !!value,
message () {
message() {
// You might want to generate a more complex message with this function.
return 'This field is required';
}
Expand Down Expand Up @@ -162,7 +161,7 @@ Rules can also be an asynchronous function, in fact vee-validate treats all rule
import { extend } from 'vee-validate';

extend('asyncRule', {
validate (value) {
validate(value) {
return new Promise(resolve => {
// simulate a network request.
setTimeout(() => {
Expand All @@ -180,7 +179,7 @@ Or if you are an `async/await` fan:
import { extend } from 'vee-validate';

extend('asyncRule', {
async validate (value) {
async validate(value) {
// some heavy work/network request.

return !!value;
Expand Down

0 comments on commit 4aff7da

Please sign in to comment.