2019-01-14 10:24:29 +00:00
|
|
|
<template>
|
|
|
|
<ContentPage heading="The Contact Page Heading">
|
2019-01-14 11:31:17 +00:00
|
|
|
|
|
|
|
<b-field label="Name">
|
2019-01-14 13:10:29 +00:00
|
|
|
<b-input v-model.trim="form.name"
|
|
|
|
placeholder="Your name ...">
|
2019-01-14 11:31:17 +00:00
|
|
|
</b-input>
|
|
|
|
</b-field>
|
|
|
|
|
|
|
|
<b-field label="Email">
|
2019-01-14 13:10:29 +00:00
|
|
|
<b-input v-model="form.email"
|
|
|
|
type="email"
|
|
|
|
placeholder="Your email ...">
|
2019-01-14 11:31:17 +00:00
|
|
|
</b-input>
|
|
|
|
</b-field>
|
|
|
|
|
|
|
|
<b-field label="Subject">
|
2019-01-14 13:10:29 +00:00
|
|
|
<b-input v-model="form.subject"
|
|
|
|
placeholder="Your subject ...">
|
2019-01-14 11:31:17 +00:00
|
|
|
</b-input>
|
|
|
|
</b-field>
|
|
|
|
|
|
|
|
<b-field label="Message">
|
2019-01-14 13:10:29 +00:00
|
|
|
<b-input v-model="form.message"
|
|
|
|
placeholder="Your message ..."
|
2019-01-14 11:31:17 +00:00
|
|
|
type="textarea">
|
|
|
|
</b-input>
|
|
|
|
</b-field>
|
|
|
|
|
|
|
|
<button class="button is-success is-outlined"
|
|
|
|
@click.prevent="onSubmit"
|
|
|
|
:disabled="isDisabled">
|
|
|
|
Send
|
|
|
|
</button>
|
2019-01-14 10:24:29 +00:00
|
|
|
</ContentPage>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import ContentPage from '@/components/ContentPage'
|
2019-01-14 13:10:29 +00:00
|
|
|
import { required, email } from 'vuelidate/lib/validators'
|
2019-01-14 10:24:29 +00:00
|
|
|
|
|
|
|
export default {
|
|
|
|
name: 'HomePage',
|
|
|
|
|
|
|
|
components: {
|
|
|
|
ContentPage
|
|
|
|
},
|
|
|
|
|
|
|
|
data() {
|
|
|
|
return {
|
2019-01-14 13:10:29 +00:00
|
|
|
attemptedSubmit: false,
|
|
|
|
form: {
|
|
|
|
name: "",
|
|
|
|
email: "",
|
|
|
|
subject: "",
|
|
|
|
message: "",
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
computed: {
|
|
|
|
isDisabled () {
|
|
|
|
return this.attemptedSubmit && this.$v.form.$invalid
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
validations: {
|
|
|
|
form: {
|
|
|
|
name: {
|
|
|
|
required,
|
|
|
|
},
|
|
|
|
email: {
|
|
|
|
required,
|
|
|
|
email
|
|
|
|
},
|
|
|
|
message: {
|
|
|
|
required,
|
|
|
|
}
|
2019-01-14 10:24:29 +00:00
|
|
|
}
|
2019-01-14 11:31:17 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
methods: {
|
|
|
|
onSubmit () {
|
2019-01-14 13:10:29 +00:00
|
|
|
this.attemptedSubmit = true
|
|
|
|
if (this.$v.form.$invalid) {
|
|
|
|
this.$toast.open({
|
|
|
|
message: 'Please correct errors before submitting.',
|
|
|
|
type: 'is-danger'
|
|
|
|
})
|
|
|
|
return
|
|
|
|
}
|
|
|
|
this.$toast.open('Submitting your message ...')
|
|
|
|
window.setTimeout(() => {
|
|
|
|
this.$toast.open({
|
|
|
|
message: 'Thank you, your message has been succesfully sent.',
|
|
|
|
type: 'is-success'
|
|
|
|
})
|
|
|
|
this.form.message = ''
|
|
|
|
this.form.subject = ''
|
|
|
|
}, 1000)
|
2019-01-14 11:31:17 +00:00
|
|
|
},
|
|
|
|
},
|
2019-01-14 10:24:29 +00:00
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style scoped lang="scss">
|
|
|
|
</style>
|
|
|
|
|