Last active
August 5, 2018 07:26
-
-
Save bayareawebpro/4ab3f9b867b01d03d598a20176e8cb4b to your computer and use it in GitHub Desktop.
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
<v-form | |
method="post" | |
route="{{ route('login') }}" | |
:data="{ email: '', password: ''}" | |
sync="user" | |
{{--@success="mySuccessMethod"--}} | |
{{--@error="myErrorMethod"--}} | |
> | |
<template slot-scope="{data, methods}"> | |
@{{ data.form }} | |
<div | |
v-if="data.responseMessage" | |
:class="{ | |
'alert alert-danger': data.validationFailed, | |
'alert alert-success': data.isSubmitted, | |
}" | |
> | |
@{{ data.responseMessage }} | |
</div> | |
<div class="form-group"> | |
<label for="email">E-Mail Address</label> | |
<input | |
id="email" | |
type="email" | |
class="form-control" | |
:class="{ 'is-invalid': methods.hasErrors('email') }" | |
v-model="data.form.email" | |
v-on:input="methods.clearErrors" | |
name="email" | |
required | |
autofocus | |
> | |
<div class="invalid-feedback" v-if="methods.hasErrors('email')"> | |
<strong>@{{ methods.getError('email') }}</strong> | |
</div> | |
</div> | |
</div> | |
<div class="form-group"> | |
<label for="password">Password</label> | |
<input | |
id="password" | |
type="password" | |
class="form-control" | |
:class="{ 'is-invalid': methods.hasErrors('password') }" | |
v-model="data.form.password" | |
v-on:input="methods.clearErrors" | |
name="password" | |
required | |
autofocus | |
> | |
<div class="invalid-feedback" v-if="methods.hasErrors('password')"> | |
<strong>@{{ methods.getError('password') }}</strong> | |
</div> | |
</div> | |
</div> | |
<button | |
type="button" | |
class="btn btn-primary" | |
@click.prevent="methods.submitForm" | |
:disabled="data.isLoading" | |
> | |
<i class="fa fa-spinner fa-spin" v-if="data.isLoading"></i> | |
Submit | |
</button> | |
<button | |
type="button" | |
class="btn btn-secondary" | |
@click.prevent="methods.resetForm" | |
:disabled="data.isLoading" | |
> | |
Reset | |
</button> | |
</template> | |
</v-form> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment