Skip to content

Instantly share code, notes, and snippets.

@ann-kilzer
Last active June 30, 2020 04:30
Show Gist options
  • Save ann-kilzer/8ba20064a4902e33d055551f40bc6ee1 to your computer and use it in GitHub Desktop.
Save ann-kilzer/8ba20064a4902e33d055551f40bc6ee1 to your computer and use it in GitHub Desktop.
Vuetify Form before Netlify
<template>
<v-form @submit.prevent="handleSubmit">
<two-button-modal
title="Send a message"
@cancel="$emit('cancel')"
>
<v-text-field
v-model="form.name"
label="Your Name"
/>
<v-text-field
v-model="form.email"
label="Email"
/>
<v-textarea
v-model="form.message"
label="Message"
/>
</two-button-modal>
</v-form>
</template>
<script>
import TwoButtonModal from './TwoButtonModal.vue';
export default {
components: {
TwoButtonModal,
},
data: () => ({
form: {
name: '',
email: '',
message: '',
},
}),
methods: {
resetForm() {
this.$set(this.form, 'name', '');
this.$set(this.form, 'email', '');
this.$set(this.form, 'message', '');
},
handleSubmit() {
// TODO: How to send this to Netlify?
this.resetForm();
},
},
};
</script>
<template>
<v-card>
<v-col>
<v-card-title>{{ title }}</v-card-title>
<v-card-text px-8>
<slot />
</v-card-text>
<v-card-actions>
<v-spacer />
<v-btn
text
@click="$emit('cancel')"
>
Cancel
</v-btn>
<v-btn
text
color="primary darken-2"
type="submit"
@click="$emit('click')"
>
Submit
</v-btn>
</v-card-actions>
</v-col>
</v-card>
</template>
<script>
export default {
props: {
title: {
type: String,
required: true,
},
},
};
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment