Chore: Add enter key listener for email input box (#809)

* Chore: Add enter key listener for email input box
This commit is contained in:
Pranav Raj S
2020-05-03 14:45:33 +05:30
committed by GitHub
parent dc6398ab56
commit 19886b40bd

View File

@@ -7,10 +7,11 @@
> >
<input <input
v-model.trim="email" v-model.trim="email"
class="form-input small" class="form-input"
placeholder="Please enter your email" placeholder="Please enter your email"
:class="{ error: $v.email.$error }" :class="{ error: $v.email.$error }"
@input="$v.email.$touch" @input="$v.email.$touch"
@keyup.enter="onSubmit"
/> />
<button <button
class="button" class="button"
@@ -68,6 +69,10 @@ export default {
}, },
methods: { methods: {
onSubmit() { onSubmit() {
if (this.$v.$invalid) {
return;
}
this.$store.dispatch('message/update', { this.$store.dispatch('message/update', {
email: this.email, email: this.email,
messageId: this.messageId, messageId: this.messageId,
@@ -86,8 +91,9 @@ export default {
min-width: 200px; min-width: 200px;
input { input {
border-top-right-radius: 0;
border-bottom-right-radius: 0; border-bottom-right-radius: 0;
border-top-right-radius: 0;
padding: $space-one;
&.error { &.error {
border-color: $color-error; border-color: $color-error;