Skip to content

Commit 0921c9a

Browse files
committed
first commit
0 parents  commit 0921c9a

22 files changed

+10977
-0
lines changed

.editorconfig

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# editorconfig.org
2+
root = true
3+
4+
[*]
5+
indent_style = space
6+
indent_size = 2
7+
end_of_line = lf
8+
charset = utf-8
9+
trim_trailing_whitespace = true
10+
insert_final_newline = true
11+
12+
[*.md]
13+
trim_trailing_whitespace = false

.eslintrc.js

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
module.exports = {
2+
root: true,
3+
env: {
4+
browser: true,
5+
node: true,
6+
},
7+
extends: [
8+
'@nuxtjs/eslint-config-typescript',
9+
'plugin:nuxt/recommended',
10+
'prettier',
11+
],
12+
plugins: [],
13+
// add your custom rules here
14+
rules: {
15+
'vue/multi-word-component-names': 'off',
16+
},
17+
}

.gitignore

+90
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
# Created by .ignore support plugin (hsz.mobi)
2+
### Node template
3+
# Logs
4+
/logs
5+
*.log
6+
npm-debug.log*
7+
yarn-debug.log*
8+
yarn-error.log*
9+
10+
# Runtime data
11+
pids
12+
*.pid
13+
*.seed
14+
*.pid.lock
15+
16+
# Directory for instrumented libs generated by jscoverage/JSCover
17+
lib-cov
18+
19+
# Coverage directory used by tools like istanbul
20+
coverage
21+
22+
# nyc test coverage
23+
.nyc_output
24+
25+
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
26+
.grunt
27+
28+
# Bower dependency directory (https://bower.io/)
29+
bower_components
30+
31+
# node-waf configuration
32+
.lock-wscript
33+
34+
# Compiled binary addons (https://nodejs.org/api/addons.html)
35+
build/Release
36+
37+
# Dependency directories
38+
node_modules/
39+
jspm_packages/
40+
41+
# TypeScript v1 declaration files
42+
typings/
43+
44+
# Optional npm cache directory
45+
.npm
46+
47+
# Optional eslint cache
48+
.eslintcache
49+
50+
# Optional REPL history
51+
.node_repl_history
52+
53+
# Output of 'npm pack'
54+
*.tgz
55+
56+
# Yarn Integrity file
57+
.yarn-integrity
58+
59+
# dotenv environment variables file
60+
.env
61+
62+
# parcel-bundler cache (https://parceljs.org/)
63+
.cache
64+
65+
# next.js build output
66+
.next
67+
68+
# nuxt.js build output
69+
.nuxt
70+
71+
# Nuxt generate
72+
dist
73+
74+
# vuepress build output
75+
.vuepress/dist
76+
77+
# Serverless directories
78+
.serverless
79+
80+
# IDE / Editor
81+
.idea
82+
83+
# Service worker
84+
sw.*
85+
86+
# macOS
87+
.DS_Store
88+
89+
# Vim swap files
90+
*.swp

.prettierignore

+96
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
###
2+
# Place your Prettier ignore content here
3+
4+
###
5+
# .gitignore content is duplicated here due to https://github.com/prettier/prettier/issues/8506
6+
7+
# Created by .ignore support plugin (hsz.mobi)
8+
### Node template
9+
# Logs
10+
/logs
11+
*.log
12+
npm-debug.log*
13+
yarn-debug.log*
14+
yarn-error.log*
15+
16+
# Runtime data
17+
pids
18+
*.pid
19+
*.seed
20+
*.pid.lock
21+
22+
# Directory for instrumented libs generated by jscoverage/JSCover
23+
lib-cov
24+
25+
# Coverage directory used by tools like istanbul
26+
coverage
27+
28+
# nyc test coverage
29+
.nyc_output
30+
31+
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
32+
.grunt
33+
34+
# Bower dependency directory (https://bower.io/)
35+
bower_components
36+
37+
# node-waf configuration
38+
.lock-wscript
39+
40+
# Compiled binary addons (https://nodejs.org/api/addons.html)
41+
build/Release
42+
43+
# Dependency directories
44+
node_modules/
45+
jspm_packages/
46+
47+
# TypeScript v1 declaration files
48+
typings/
49+
50+
# Optional npm cache directory
51+
.npm
52+
53+
# Optional eslint cache
54+
.eslintcache
55+
56+
# Optional REPL history
57+
.node_repl_history
58+
59+
# Output of 'npm pack'
60+
*.tgz
61+
62+
# Yarn Integrity file
63+
.yarn-integrity
64+
65+
# dotenv environment variables file
66+
.env
67+
68+
# parcel-bundler cache (https://parceljs.org/)
69+
.cache
70+
71+
# next.js build output
72+
.next
73+
74+
# nuxt.js build output
75+
.nuxt
76+
77+
# Nuxt generate
78+
dist
79+
80+
# vuepress build output
81+
.vuepress/dist
82+
83+
# Serverless directories
84+
.serverless
85+
86+
# IDE / Editor
87+
.idea
88+
89+
# Service worker
90+
sw.*
91+
92+
# macOS
93+
.DS_Store
94+
95+
# Vim swap files
96+
*.swp

.prettierrc

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"semi": false,
3+
"singleQuote": true
4+
}

README.md

+68
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
# form-example
2+
3+
## Build Setup
4+
5+
```bash
6+
# install dependencies
7+
$ yarn install
8+
9+
# serve with hot reload at localhost:3000
10+
$ yarn dev
11+
12+
# build for production and launch server
13+
$ yarn build
14+
$ yarn start
15+
16+
# generate static project
17+
$ yarn generate
18+
```
19+
20+
For detailed explanation on how things work, check out the [documentation](https://nuxtjs.org).
21+
22+
## Special Directories
23+
24+
You can create the following extra directories, some of which have special behaviors. Only `pages` is required; you can delete them if you don't want to use their functionality.
25+
26+
### `assets`
27+
28+
The assets directory contains your uncompiled assets such as Stylus or Sass files, images, or fonts.
29+
30+
More information about the usage of this directory in [the documentation](https://nuxtjs.org/docs/2.x/directory-structure/assets).
31+
32+
### `components`
33+
34+
The components directory contains your Vue.js components. Components make up the different parts of your page and can be reused and imported into your pages, layouts and even other components.
35+
36+
More information about the usage of this directory in [the documentation](https://nuxtjs.org/docs/2.x/directory-structure/components).
37+
38+
### `layouts`
39+
40+
Layouts are a great help when you want to change the look and feel of your Nuxt app, whether you want to include a sidebar or have distinct layouts for mobile and desktop.
41+
42+
More information about the usage of this directory in [the documentation](https://nuxtjs.org/docs/2.x/directory-structure/layouts).
43+
44+
### `pages`
45+
46+
This directory contains your application views and routes. Nuxt will read all the `*.vue` files inside this directory and setup Vue Router automatically.
47+
48+
More information about the usage of this directory in [the documentation](https://nuxtjs.org/docs/2.x/get-started/routing).
49+
50+
### `plugins`
51+
52+
The plugins directory contains JavaScript plugins that you want to run before instantiating the root Vue.js Application. This is the place to add Vue plugins and to inject functions or constants. Every time you need to use `Vue.use()`, you should create a file in `plugins/` and add its path to plugins in `nuxt.config.js`.
53+
54+
More information about the usage of this directory in [the documentation](https://nuxtjs.org/docs/2.x/directory-structure/plugins).
55+
56+
### `static`
57+
58+
This directory contains your static files. Each file inside this directory is mapped to `/`.
59+
60+
Example: `/static/robots.txt` is mapped as `/robots.txt`.
61+
62+
More information about the usage of this directory in [the documentation](https://nuxtjs.org/docs/2.x/directory-structure/static).
63+
64+
### `store`
65+
66+
This directory contains your Vuex store files. Creating a file in this directory automatically activates Vuex.
67+
68+
More information about the usage of this directory in [the documentation](https://nuxtjs.org/docs/2.x/directory-structure/store).

components/Demo/Component.vue

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<template>
2+
<div>
3+
<div v-if="submitted" class="text-center p-2">
4+
<p class="text-green-700">Success! Your information has been saved</p>
5+
</div>
6+
<Form @submit="$emit('submit', $event)" />
7+
<div v-if="loading" class="flex flex-row justify-center py-2">
8+
<Loader />
9+
</div>
10+
</div>
11+
</template>
12+
<script lang="ts">
13+
import Form from './Form.vue'
14+
import Loader from '@/components/MultiUse/Loader.vue'
15+
export default {
16+
components: {
17+
Form,
18+
Loader,
19+
},
20+
props: {
21+
submitted: {
22+
type: Boolean,
23+
required: true,
24+
},
25+
loading: {
26+
type: Boolean,
27+
required: true,
28+
},
29+
},
30+
}
31+
</script>

components/Demo/Container.vue

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<template>
2+
<div>
3+
<DemoComponent
4+
:submitted="submitted"
5+
:loading="loading"
6+
@submit="handleSubmit($event)"
7+
/>
8+
</div>
9+
</template>
10+
<script lang="ts">
11+
import DemoComponent from './Component.vue'
12+
13+
interface FormModel {
14+
first: string
15+
last: string
16+
email: string
17+
state: string
18+
}
19+
20+
export default {
21+
components: {
22+
DemoComponent,
23+
},
24+
data() {
25+
return {
26+
submitted: false,
27+
loading: false,
28+
}
29+
},
30+
methods: {
31+
handleSubmit(formModel: FormModel) {
32+
this.loading = true
33+
this.apiRequest(formModel)
34+
// this.$emit('finished')
35+
},
36+
apiRequest(formModel: FormModel) {
37+
setTimeout(() => {
38+
console.log(JSON.stringify(formModel))
39+
this.submitted = true
40+
this.loading = false
41+
}, 2000)
42+
},
43+
},
44+
}
45+
</script>

0 commit comments

Comments
 (0)