Feat: init vuex

This commit is contained in:
Bertrand Benjamin 2021-07-07 09:00:33 +02:00
parent db56f7cbbd
commit b6759c5682
6 changed files with 60 additions and 4 deletions

22
package-lock.json generated
View File

@ -10,7 +10,8 @@
"dependencies": {
"core-js": "^3.6.5",
"vue": "^3.0.0",
"vue-router": "^4.0.8"
"vue-router": "^4.0.8",
"vuex": "^4.0.2"
},
"devDependencies": {
"@vue/cli-plugin-babel": "~4.5.0",
@ -18390,6 +18391,17 @@
"dev": true,
"license": "MIT"
},
"node_modules/vuex": {
"version": "4.0.2",
"resolved": "https://registry.npmjs.org/vuex/-/vuex-4.0.2.tgz",
"integrity": "sha512-M6r8uxELjZIK8kTKDGgZTYX/ahzblnzC4isU1tpmEuOIIKmV+TRdc+H4s8ds2NuZ7wpUTdGRzJRtoj+lI+pc0Q==",
"dependencies": {
"@vue/devtools-api": "^6.0.0-beta.11"
},
"peerDependencies": {
"vue": "^3.0.2"
}
},
"node_modules/watchpack": {
"version": "1.7.5",
"resolved": "https://registry.npmjs.org/watchpack/-/watchpack-1.7.5.tgz",
@ -33116,6 +33128,14 @@
"integrity": "sha512-4gDntzrifFnCEvyoO8PqyJDmguXgVPxKiIxrBKjIowvL9l+N66196+72XVYR8BBf1Uv1Fgt3bGevJ+sEmxfZzw==",
"dev": true
},
"vuex": {
"version": "4.0.2",
"resolved": "https://registry.npmjs.org/vuex/-/vuex-4.0.2.tgz",
"integrity": "sha512-M6r8uxELjZIK8kTKDGgZTYX/ahzblnzC4isU1tpmEuOIIKmV+TRdc+H4s8ds2NuZ7wpUTdGRzJRtoj+lI+pc0Q==",
"requires": {
"@vue/devtools-api": "^6.0.0-beta.11"
}
},
"watchpack": {
"version": "1.7.5",
"resolved": "https://registry.npmjs.org/watchpack/-/watchpack-1.7.5.tgz",

View File

@ -15,7 +15,8 @@
"dependencies": {
"core-js": "^3.6.5",
"vue": "^3.0.0",
"vue-router": "^4.0.8"
"vue-router": "^4.0.8",
"vuex": "^4.0.2"
},
"devDependencies": {
"@vue/cli-plugin-babel": "~4.5.0",

View File

@ -1,8 +1,10 @@
import { createApp } from 'vue'
import App from '@/App.vue'
import router from '@/router'
import store from '@/store'
const app = createApp(App)
app.use(router)
app.use(store)
app.mount('#app')

17
src/store/datas/index.js Normal file
View File

@ -0,0 +1,17 @@
const data = {
namespaced: true,
state () {
return {
count: 0
}
},
getters: {
},
mutations: {
increment (state) {
state.count++
}
}
}
export default data

9
src/store/index.js Normal file
View File

@ -0,0 +1,9 @@
import { createStore } from 'vuex'
import dataModule from "./datas"
// Create a new store instance.
const store = createStore({
datas: dataModule,
})
export default store

View File

@ -1532,7 +1532,7 @@
optionalDependencies:
"prettier" "^1.18.2"
"@vue/devtools-api@^6.0.0-beta.10":
"@vue/devtools-api@^6.0.0-beta.10", "@vue/devtools-api@^6.0.0-beta.11":
"integrity" "sha512-oZ0n/N4UWpkMvbR1OrBtu+YhaVADo+bYX5lxo9tou7h10p0+v2K9yzzaZATVr0lqHb7iY1wALfO8yojwg0MTHw=="
"resolved" "https://registry.npmjs.org/@vue/devtools-api/-/devtools-api-6.0.0-beta.13.tgz"
"version" "6.0.0-beta.13"
@ -9881,7 +9881,7 @@
"resolved" "https://registry.npmjs.org/vue-template-es2015-compiler/-/vue-template-es2015-compiler-1.9.1.tgz"
"version" "1.9.1"
"vue@^2 || ^3.0.0-0", "vue@^3.0.0", "vue@3.0.11":
"vue@^2 || ^3.0.0-0", "vue@^3.0.0", "vue@^3.0.2", "vue@3.0.11":
"integrity" "sha512-3/eUi4InQz8MPzruHYSTQPxtM3LdZ1/S/BvaU021zBnZi0laRUyH6pfuE4wtUeLvI8wmUNwj5wrZFvbHUXL9dw=="
"resolved" "https://registry.npmjs.org/vue/-/vue-3.0.11.tgz"
"version" "3.0.11"
@ -9890,6 +9890,13 @@
"@vue/runtime-dom" "3.0.11"
"@vue/shared" "3.0.11"
"vuex@^4.0.2":
"integrity" "sha512-M6r8uxELjZIK8kTKDGgZTYX/ahzblnzC4isU1tpmEuOIIKmV+TRdc+H4s8ds2NuZ7wpUTdGRzJRtoj+lI+pc0Q=="
"resolved" "https://registry.npmjs.org/vuex/-/vuex-4.0.2.tgz"
"version" "4.0.2"
dependencies:
"@vue/devtools-api" "^6.0.0-beta.11"
"watchpack-chokidar2@^2.0.1":
"integrity" "sha512-nCFfBIPKr5Sh61s4LPpy1Wtfi0HE8isJ3d2Yb5/Ppw2P2B/3eVSEBjKfN0fmHJSK14+31KwMKmcrzs2GM4P0Ww=="
"resolved" "https://registry.npmjs.org/watchpack-chokidar2/-/watchpack-chokidar2-2.0.1.tgz"