-
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.
init of vuelidate library for Magento 2
- Loading branch information
0 parents
commit 06bd36e
Showing
8 changed files
with
98 additions
and
0 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 |
---|---|---|
@@ -0,0 +1 @@ | ||
.DS_Store |
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,46 @@ | ||
[![Latest Stable Version](https://poser.pugx.org/deadsimple/vuelidatelibrary/version)](https://packagist.org/packages/deadsimple/vuelidatelibrary) [![Total Downloads](https://poser.pugx.org/deadsimple/vuelidatelibrary/downloads)](https://packagist.org/packages/deadsimple/vuelidatelibrary) [![License](https://poser.pugx.org/deadsimple/vuelidatelibrary/license)](https://packagist.org/packages/deadsimple/vuelidatelibrary) | ||
|
||
# Deadsimple Vuelidate Magento2 Composer Library | ||
|
||
Implement modern form validation to your Magento 2 VueJS forms using [vuelidate](https://vuelidate.js.org/) | ||
|
||
## Installation | ||
|
||
Use composer to install the module: `composer require deadsimple/vuelidatelibrary` | ||
|
||
## Usage | ||
|
||
To use Vuelidate you will need to load the `Vuelidate` library and it's `Validators` using the Magento 2 requirejs methods. Select the neccesary mixin and the validators you would like to use with the destructure syntax. Load the mixin like any other mixins and start using Vuelidate as described in it's [documentation](https://vuelidate.js.org/#getting-started). | ||
|
||
|
||
``` | ||
define([ | ||
'Vue', | ||
'Vuelidate', | ||
'VuelidateValidators', | ||
], function (Vue, Vuelidate, validators) { | ||
const {validationMixin} = Vuelidate; | ||
const {required, email } = validators; | ||
Vue.component('contactForm', { | ||
template: template, | ||
mixins: [ validationMixin ], | ||
data() { | ||
return { | ||
name: null, | ||
email: null, | ||
} | ||
}, | ||
validations(){ | ||
name: { required }, | ||
email: { required, email } | ||
} | ||
}) | ||
}) | ||
``` | ||
|
||
### Version | ||
|
||
This library loads: `Vuelidate v0.7.5` | ||
|
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,21 @@ | ||
{ | ||
"name": "deadsimple/vuelidate", | ||
"description": "A deadsimple module to use Vuelidate in your Modern Magento 2 Vue Projects ", | ||
"type": "magento2-module", | ||
"license": "MIT", | ||
"authors": [ | ||
{ | ||
"name": "Maurits Meester", | ||
"email": "[email protected]" | ||
} | ||
], | ||
"autoload": { | ||
"files": [ | ||
"registration.php" | ||
] | ||
}, | ||
"require": { | ||
"magento/framework": "100.1.*|101.0.*|102.0.*", | ||
"deadsimple/vuelibrary": ">=1.0" | ||
} | ||
} |
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,9 @@ | ||
<?xml version="1.0"?> | ||
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd"> | ||
<module name="Deadsimple_Vuelidate"> | ||
<sequence> | ||
<module name="Deadsimple_VueLibrary"/> | ||
</sequence> | ||
</module> | ||
</config> |
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,7 @@ | ||
<?php | ||
|
||
\Magento\Framework\Component\ComponentRegistrar::register( | ||
\Magento\Framework\Component\ComponentRegistrar::MODULE, | ||
'Deadsimple_Vuelidate', | ||
__DIR__ | ||
); |
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,12 @@ | ||
var config = { | ||
map: { | ||
'*': { | ||
'Vuelidate': 'Deadsimple_Vuelidate/js/lib/vuelidate.min', | ||
'VuelidateValidators': 'Deadsimple_Vuelidate/js/lib/validators.min', | ||
} | ||
}, | ||
shim: { | ||
'Vuelidate': ['Vue'], | ||
'VuelidateValidators': ['Vue'] | ||
} | ||
}; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.