Skip to content

Commit 093cc84

Browse files
committed
feat (vuex) init vuex 4
1 parent e2a2152 commit 093cc84

File tree

4 files changed

+25
-4
lines changed

4 files changed

+25
-4
lines changed

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,13 @@
1010
},
1111
"dependencies": {
1212
"vue": "^3.2.6",
13-
"vue-router": "^4.0.11"
13+
"vue-router": "^4.0.11",
14+
"vuex": "^4.0.2"
1415
},
1516
"devDependencies": {
17+
"@types/node": "^16.7.1",
1618
"@typescript-eslint/eslint-plugin": "^4.30.0",
1719
"@typescript-eslint/parser": "^4.30.0",
18-
"@types/node": "^16.7.1",
1920
"@vitejs/plugin-vue": "^1.6.0",
2021
"@vue/compiler-sfc": "^3.0.5",
2122
"@vue/eslint-config-prettier": "^6.0.0",

src/main.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ import { createApp } from "vue";
22
import App from "@/App.vue";
33
import router from "@/router";
44

5+
import { store } from "./store";
6+
57
import "./assets/scss/style.scss";
68

7-
const app = createApp(App).use(router).mount("#app");
9+
const app = createApp(App).use(store).use(router).mount("#app");

src/store/index.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import { createStore, createLogger } from "vuex";
2+
3+
// Plug in logger when in development environment
4+
const debug = process.env.NODE_ENV !== "production";
5+
const plugins = debug ? [createLogger({})] : [];
6+
7+
export const store = createStore({
8+
plugins,
9+
modules: {},
10+
strict: debug,
11+
});

yarn.lock

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,7 @@
353353
"@vue/compiler-dom" "3.2.21"
354354
"@vue/shared" "3.2.21"
355355

356-
"@vue/devtools-api@^6.0.0-beta.18":
356+
"@vue/devtools-api@^6.0.0-beta.11", "@vue/devtools-api@^6.0.0-beta.18":
357357
version "6.0.0-beta.19"
358358
resolved "https://registry.yarnpkg.com/@vue/devtools-api/-/devtools-api-6.0.0-beta.19.tgz#f8e88059daa424515992426a0c7ea5cde07e99bf"
359359
integrity sha512-ObzQhgkoVeoyKv+e8+tB/jQBL2smtk/NmC9OmFK8UqdDpoOdv/Kf9pyDWL+IFyM7qLD2C75rszJujvGSPSpGlw==
@@ -2263,6 +2263,13 @@ vue@^3.2.6:
22632263
"@vue/server-renderer" "3.2.21"
22642264
"@vue/shared" "3.2.21"
22652265

2266+
vuex@^4.0.2:
2267+
version "4.0.2"
2268+
resolved "https://registry.yarnpkg.com/vuex/-/vuex-4.0.2.tgz#f896dbd5bf2a0e963f00c67e9b610de749ccacc9"
2269+
integrity sha512-M6r8uxELjZIK8kTKDGgZTYX/ahzblnzC4isU1tpmEuOIIKmV+TRdc+H4s8ds2NuZ7wpUTdGRzJRtoj+lI+pc0Q==
2270+
dependencies:
2271+
"@vue/devtools-api" "^6.0.0-beta.11"
2272+
22662273
which@^2.0.1:
22672274
version "2.0.2"
22682275
resolved "https://registry.yarnpkg.com/which/-/which-2.0.2.tgz#7c6a8dd0a636a0327e10b59c9286eee93f3f51b1"

0 commit comments

Comments
 (0)