diff --git a/2021-09-06_composition-19-vuex-starting-project/.browserslistrc b/2021-09-06_composition-19-vuex-starting-project/.browserslistrc new file mode 100644 index 0000000..214388f --- /dev/null +++ b/2021-09-06_composition-19-vuex-starting-project/.browserslistrc @@ -0,0 +1,3 @@ +> 1% +last 2 versions +not dead diff --git a/2021-09-06_composition-19-vuex-starting-project/.eslintrc.js b/2021-09-06_composition-19-vuex-starting-project/.eslintrc.js new file mode 100644 index 0000000..3391da1 --- /dev/null +++ b/2021-09-06_composition-19-vuex-starting-project/.eslintrc.js @@ -0,0 +1,17 @@ +module.exports = { + root: true, + env: { + node: true + }, + 'extends': [ + 'plugin:vue/vue3-essential', + 'eslint:recommended' + ], + parserOptions: { + parser: 'babel-eslint' + }, + rules: { + 'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off', + 'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off' + } +} diff --git a/2021-09-06_composition-19-vuex-starting-project/.gitignore b/2021-09-06_composition-19-vuex-starting-project/.gitignore new file mode 100644 index 0000000..11f5d71 --- /dev/null +++ b/2021-09-06_composition-19-vuex-starting-project/.gitignore @@ -0,0 +1,22 @@ +.DS_Store +node_modules +/dist + +# local env files +.env.local +.env.*.local + +# Log files +npm-debug.log* +yarn-debug.log* +yarn-error.log* +pnpm-debug.log* + +# Editor directories and files +.idea +.vscode +*.suo +*.ntvs* +*.njsproj +*.sln +*.sw? diff --git a/2021-09-06_composition-19-vuex-starting-project/.prettierrc b/2021-09-06_composition-19-vuex-starting-project/.prettierrc new file mode 100644 index 0000000..92cde39 --- /dev/null +++ b/2021-09-06_composition-19-vuex-starting-project/.prettierrc @@ -0,0 +1,3 @@ +{ + "singleQuote": true +} \ No newline at end of file diff --git a/2021-09-06_composition-19-vuex-starting-project/HOW-TO-USE.pdf b/2021-09-06_composition-19-vuex-starting-project/HOW-TO-USE.pdf new file mode 100644 index 0000000..00d28ea Binary files /dev/null and b/2021-09-06_composition-19-vuex-starting-project/HOW-TO-USE.pdf differ diff --git a/2021-09-06_composition-19-vuex-starting-project/babel.config.js b/2021-09-06_composition-19-vuex-starting-project/babel.config.js new file mode 100644 index 0000000..e955840 --- /dev/null +++ b/2021-09-06_composition-19-vuex-starting-project/babel.config.js @@ -0,0 +1,5 @@ +module.exports = { + presets: [ + '@vue/cli-plugin-babel/preset' + ] +} diff --git a/2021-09-06_composition-19-vuex-starting-project/package.json b/2021-09-06_composition-19-vuex-starting-project/package.json new file mode 100644 index 0000000..2524b57 --- /dev/null +++ b/2021-09-06_composition-19-vuex-starting-project/package.json @@ -0,0 +1,24 @@ +{ + "name": "vue-first-app", + "version": "0.1.0", + "private": true, + "scripts": { + "serve": "vue-cli-service serve", + "build": "vue-cli-service build", + "lint": "vue-cli-service lint" + }, + "dependencies": { + "core-js": "^3.6.5", + "vue": "^3.0.0", + "vuex": "^4.0.0-0" + }, + "devDependencies": { + "@vue/cli-plugin-babel": "~4.5.0", + "@vue/cli-plugin-eslint": "~4.5.0", + "@vue/cli-service": "~4.5.0", + "@vue/compiler-sfc": "^3.0.0-0", + "babel-eslint": "^10.1.0", + "eslint": "^6.7.2", + "eslint-plugin-vue": "^7.0.0-0" + } +} diff --git a/2021-09-06_composition-19-vuex-starting-project/public/favicon.ico b/2021-09-06_composition-19-vuex-starting-project/public/favicon.ico new file mode 100644 index 0000000..df36fcf Binary files /dev/null and b/2021-09-06_composition-19-vuex-starting-project/public/favicon.ico differ diff --git a/2021-09-06_composition-19-vuex-starting-project/public/index.html b/2021-09-06_composition-19-vuex-starting-project/public/index.html new file mode 100644 index 0000000..4123528 --- /dev/null +++ b/2021-09-06_composition-19-vuex-starting-project/public/index.html @@ -0,0 +1,17 @@ + + + + + + + + <%= htmlWebpackPlugin.options.title %> + + + +
+ + + diff --git a/2021-09-06_composition-19-vuex-starting-project/src/App.vue b/2021-09-06_composition-19-vuex-starting-project/src/App.vue new file mode 100644 index 0000000..4b43b3a --- /dev/null +++ b/2021-09-06_composition-19-vuex-starting-project/src/App.vue @@ -0,0 +1,40 @@ + + + + + \ No newline at end of file diff --git a/2021-09-06_composition-19-vuex-starting-project/src/components/ControlCenter.vue b/2021-09-06_composition-19-vuex-starting-project/src/components/ControlCenter.vue new file mode 100644 index 0000000..696a0e6 --- /dev/null +++ b/2021-09-06_composition-19-vuex-starting-project/src/components/ControlCenter.vue @@ -0,0 +1,13 @@ + + + \ No newline at end of file diff --git a/2021-09-06_composition-19-vuex-starting-project/src/components/TheCounter.vue b/2021-09-06_composition-19-vuex-starting-project/src/components/TheCounter.vue new file mode 100644 index 0000000..7d96f57 --- /dev/null +++ b/2021-09-06_composition-19-vuex-starting-project/src/components/TheCounter.vue @@ -0,0 +1,13 @@ + + + \ No newline at end of file diff --git a/2021-09-06_composition-19-vuex-starting-project/src/main.js b/2021-09-06_composition-19-vuex-starting-project/src/main.js new file mode 100644 index 0000000..251543e --- /dev/null +++ b/2021-09-06_composition-19-vuex-starting-project/src/main.js @@ -0,0 +1,33 @@ +import { createApp } from 'vue'; +import { createStore } from 'vuex'; + +import App from './App.vue'; + +const store = createStore({ + state() { + return { + counter: 0 + } + }, + mutations: { + increment(state) { + state.counter++; + } + }, + actions: { + increment(context) { + context.commit('increment'); + } + }, + getters: { + counter(state) { + return state.counter + } + } +}); + +const app = createApp(App); + +app.use(store); + +app.mount('#app'); diff --git a/docker-compose.yml b/docker-compose.yml index ed26d43..4de12c5 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -8,4 +8,4 @@ services: ports: - 8080:8080 volumes: - - ./2021-09-06_composition-17-routing-starting-project/:/app + - ./2021-09-06_composition-19-vuex-starting-project/:/app