Skip to content

Instantly share code, notes, and snippets.

@jacobarriola
Last active November 13, 2017 00:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jacobarriola/89b19c9f934a737c7368754b60c8d66a to your computer and use it in GitHub Desktop.
Save jacobarriola/89b19c9f934a737c7368754b60c8d66a to your computer and use it in GitHub Desktop.
<template>
<form @submit.prevent="submitForm">
<input type="email" name="email" v-model="email">
<textarea name="message" cols="30" rows="5" v-model="message" required></textarea>
<input type="submit" value="Submit">
</form>
</template>
<script>
export default {
data () {
return {
email: '',
message: '',
endpoint: 'https://formspree.io/YOUR-EMAIL@SOMETHING.com'
}
},
methods: {
async submitForm () {
const data = {
email: this.email,
message: this.message
}
const response = await this.$axios.post(this.endpoint, data)
}
}
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment