forked from vuelidate/vuelidate
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
30 changed files
with
355 additions
and
389 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
{ | ||
"presets": ["es2015", "stage-2"], | ||
"plugins": ["transform-export-extensions"], | ||
"comments": false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
- function grabTemplate (path) { | ||
- return require('!!raw!vue-loader/lib/selector?type=template!examples/' + path + '.vue') | ||
- } | ||
- function grabScript (path) { | ||
- return require('!!raw!vue-loader/lib/selector?type=script!examples/' + path + '.vue').replace(/^[\/\n]*/m,'') | ||
- } | ||
- function hyphenate (path) { | ||
- return path | ||
- .replace(/^[A-Z]/, x => x.toLowerCase()) | ||
- .replace(/[A-Z ]/g, x => '-' + x.toLowerCase()) | ||
- .replace(/[^A-Za-z]/g, '-') | ||
- .replace(/-{2,}/g, '-') | ||
- } | ||
|
||
mixin section(name) | ||
.grid__row | ||
.grid__column | ||
section.docs(id=hyphenate(name)) | ||
h1.typo__h1=name | ||
hr.typo__hr | ||
if block | ||
block | ||
|
||
mixin subsection(name) | ||
.grid__row | ||
.grid__column | ||
h2.typo__h2(id='sub-' + hyphenate(name))=name | ||
if block | ||
block | ||
|
||
mixin nav-section(name) | ||
li.list__heading | ||
a.link.blank__link(href="#" + hyphenate(name))=name | ||
|
||
mixin nav-subsection(name) | ||
li.list__element | ||
a.link.list__link(href="#sub-" + hyphenate(name))=name | ||
|
||
mixin example(path) | ||
.example | ||
if block | ||
block | ||
.grid__column.grid__unit--md-5 | ||
#{hyphenate(path)} | ||
.grid__column.grid__unit--md-7 | ||
label.typo__label Code sample | ||
pre(v-pre).language-jade | ||
code=grabTemplate(path) | ||
pre(v-pre).language-javascript | ||
code=grabScript(path) |
File renamed without changes
File renamed without changes.
File renamed without changes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,14 @@ | ||
.grid__row | ||
.grid__column | ||
section.docs#getting-started | ||
h1.typo__h1 Getting started | ||
hr.typo__hr | ||
|
||
.grid__row | ||
.grid__column | ||
h2.typo__h2 Installation | ||
pre.language-bash | ||
code. | ||
npm install vue-validation --save | ||
|
||
.grid__column | ||
h2.typo__h2 Basic usage | ||
pre.language-javascript | ||
code. | ||
import Vue from 'vue' | ||
import Validation from 'vue-validation' | ||
Vue.use(Validation) | ||
|
||
.grid__row | ||
.grid__column | ||
h2.typo__h2 Package content | ||
|
||
.grid__column.grid__unit--md-5 | ||
p.typo__p | ||
| Simple, lightweight model-based validation for Vue.js | ||
+section('Getting started') | ||
+subsection('Installation') | ||
pre.language-bash | ||
code. | ||
npm install vue-validation --save | ||
+subsection('Basic usage') | ||
pre.language-javascript | ||
code. | ||
import Vue from 'vue' | ||
import Validation from 'vue-validation' | ||
Vue.use(Validation) | ||
+subsection('Package content') | ||
p.typo__p | ||
| Simple, lightweight model-based validation for Vue.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,19 @@ | ||
mixin nav-element(componentName, href) | ||
li.list__element | ||
a.link.list__link(href="#" + href)= componentName | ||
|
||
ul.list( | ||
:class="{ 'list--sticky': isNavSticky }" | ||
) | ||
li.list__heading Setup | ||
+nav-element('Getting Started', 'getting-started') | ||
+nav-section('Getting Started') | ||
+nav-subsection('Installation') | ||
+nav-subsection('Basic usage') | ||
+nav-subsection('Package content') | ||
|
||
li.list__heading Examples | ||
+nav-element('Basic', 'basic') | ||
+nav-section('Examples') | ||
+nav-subsection('Basic form') | ||
+nav-subsection('Contextified validators') | ||
+nav-subsection('Data nesting') | ||
+nav-subsection('Validation Groups') | ||
+nav-subsection('Collections validation') | ||
|
||
li.list__heading API | ||
+nav-element('Props', 'props') | ||
+nav-element('Events', 'events') | ||
+nav-element('Slots', 'slots') | ||
+nav-section('API') | ||
+nav-subsection('Props') | ||
+nav-subsection('Events') | ||
+nav-subsection('Slots') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
+section('API') | ||
include ./_props | ||
include ./_events | ||
include ./_slots |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
h2.typo__h2#events Events | ||
.grid__row | ||
+subsection('Events') | ||
.table__container | ||
table.table.table--full-size | ||
thead | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<template lang="pug"> | ||
div | ||
.form-group(v-bind:class="{ 'form-group--error': $v.name.$error }") | ||
label.form__label Name | ||
input.form__input(v-model="name" @input="$v.name.$touch()") | ||
span.form-group__message(v-if="!$v.name.required") Field is required | ||
span.form-group__message(v-if="!$v.name.minLength") Name must be longer than 6 letters. | ||
pre | ||
| name: {{ $v.name }} | ||
|
||
.form-group(v-bind:class="{ 'form-group--error': $v.age.$error }") | ||
label.form__label Age | ||
input.form__input(v-model="age" @blur="$v.age.$touch()") | ||
span.form-group__message(v-if="!$v.age.between") Must be between 20 and 30 | ||
pre | ||
| age: {{ $v.age }} | ||
</template> | ||
|
||
<script> | ||
import { required, minLength, between } from 'vue-validations/lib/validators' | ||
export default { | ||
data () { | ||
return { | ||
name: '', | ||
age: 0 | ||
} | ||
}, | ||
validations: { | ||
name: { | ||
required, | ||
minLength: minLength(4) | ||
}, | ||
age: { | ||
between: between(20, 30) | ||
} | ||
} | ||
} | ||
</script> |
Oops, something went wrong.