<template>
<FormulateForm
class="inputs"
@submit="login"
v-model="values"
>
<a
href="#"
@click.prevent="beMike"
v-text="`Be like mike`"
/>
<FormulateInput
type="email"
name="email"
label="Email address"
validation="required|email"
/>
<FormulateInput
type="password"
name="password"
label="Password"
validation="required"
/>
<FormulateInput
label="Login"
type="submit"
/>
<pre>{{ values }}</pre>
</FormulateForm>
</template>
<script>
export default {
data() {
return {
values: {}
};
},
methods: {
login(data) {
/* do something with data:
* { email: 'zzz@zzz.com', password: 'xyz' }
*/
alert("Logged in");
},
beMike () {
this.values = {
...this.values,
...{ email: 'mike@jordan.com'}
}
}
}
};
</script>
<style lang="scss">
.inputs {
background-color: white;
max-width: 20em;
padding: 2em;
margin: 6.5em auto 2em auto;
border-radius: 0.25em;
box-shadow: 0 0 1em rgba(0, 0, 0, 0.25);
}
pre {
display: block;
background-color: #e7f6ef;
padding: .25em;
border-radius: .25em;
}
html {
min-height: 100%;
}
body {
padding: 2em;
background-image: url("https://vueformulate.com/logo.svg"),
linear-gradient(-45deg, #7ccea9, #ffffff);
background-repeat: no-repeat;
background-size: 3em, 100%;
background-position: center 2em, center center;
}
</style>