NuxtJS Guide
Add A Contact Form To NuxtJS
Here is a guide for integrating Fabform with a Nuxt.js site:
Step 1: Create a new Nuxt site
If you haven’t set up a Nuxt app yet:
-
Create Nuxt App: Run the following command to create a new Nuxt app. You’ll be prompted to name your project:
-
Navigate to Your Project: Move into the newly created project directory:
-
Start Development Server: Launch the Nuxt development environment:
Nuxt will start a hot-reloading development environment accessible at http://localhost:3000/
.
Step 2: Add a Contact Section to your Nuxt site
-
Install Axios: Install Axios, a promise-based HTTP client, to handle HTTP requests:
-
Create Contact Page: Inside the
pages
directory of your Nuxt app, create a new Vue file namedcontact.vue
. -
Update Contact Page Content: Replace the content of
contact.vue
with the following code block:Note: Replace
{your-form-endpoint}
with the unique form endpoint provided by Fabform.
Step 3: Run your Nuxt app locally to finalize setup
-
Start Nuxt Development Server: Run the following command to see your Nuxt form in action at
localhost:3000/contact/
:
That’s it! Your Nuxt app is now integrated with Fabform for handling form submissions.