Skip to content

Commit

Permalink
chore(#28): add DruxtEntityForm example
Browse files Browse the repository at this point in the history
  • Loading branch information
Decipher committed Oct 9, 2021
1 parent ee15810 commit dbaf266
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 0 deletions.
9 changes: 9 additions & 0 deletions examples/nuxt/entity-form/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# entity-form

This directory contains an example of the DruxtEntityForm component in Nuxt.

## Setup

```
yarn && yarn dev
```
3 changes: 3 additions & 0 deletions examples/nuxt/entity-form/nuxt.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export default {
buildModules: [['druxt-entity', { baseUrl: process.env.BASE_URL || 'https://demo-api.druxtjs.org' }]]
}
12 changes: 12 additions & 0 deletions examples/nuxt/entity-form/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"name": "entity-form",
"private": true,
"packageManager": "[email protected]",
"scripts": {
"dev": "nuxt"
},
"dependencies": {
"druxt-site": "link:../../../packages/druxt-entity",
"nuxt": "latest"
}
}
31 changes: 31 additions & 0 deletions examples/nuxt/entity-form/pages/index.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<template>
<div>
<h1>DruxtEntityForm example:</h1>

<h2>Contact form - Basic</h2>
<pre><code>&lt;DruxtEntityForm type="contact_message--feedback" /&gt;</code></pre>

<pre v-if="response">
<code>{{ JSON.stringify(response, null, ' ') }}</code>
</pre>

<DruxtEntityForm
type="contact_message--feedback"
@error="setResponse"
@submit="setResponse"
/>
</div>
</template>

<script>
export default {
data: () => ({
response: null,
}),
methods: {
setResponse(response) {
this.response = response;
},
},
};
</script>
Empty file.

0 comments on commit dbaf266

Please sign in to comment.