feat: use vuex 4 for vue3

This commit is contained in:
Dominik Pschenitschni 2021-08-20 15:32:53 +02:00
parent 72518212da
commit 3d6aca3510
No known key found for this signature in database
GPG key ID: B257AC0149F43A77
4 changed files with 25 additions and 11 deletions

View file

@ -37,7 +37,7 @@
"vue-router": "4.0.11", "vue-router": "4.0.11",
"vue-shortkey": "3.1.7", "vue-shortkey": "3.1.7",
"vuedraggable": "2.24.3", "vuedraggable": "2.24.3",
"vuex": "3.6.2", "vuex": "4.0.2",
"workbox-precaching": "6.3.0" "workbox-precaching": "6.3.0"
}, },
"devDependencies": { "devDependencies": {

View file

@ -1,5 +1,4 @@
import Vue from 'vue' import { createStore } from 'vuex'
import Vuex from 'vuex'
import { import {
CURRENT_LIST, CURRENT_LIST,
ERROR_MESSAGE, ERROR_MESSAGE,
@ -21,9 +20,7 @@ import labels from './modules/labels'
import ListService from '../services/list' import ListService from '../services/list'
Vue.use(Vuex) export const store = createStore({
export const store = new Vuex.Store({
strict: import.meta.env.DEV, strict: import.meta.env.DEV,
modules: { modules: {
config, config,

View file

@ -2,3 +2,18 @@ declare module '*.vue' {
import Vue from 'vue' import Vue from 'vue'
export default Vue export default Vue
} }
// https://next.vuex.vuejs.org/guide/migrating-to-4-0-from-3-x.html#typescript-support
import { ComponentCustomProperties } from 'vue'
import { Store } from 'vuex'
declare module '@vue/runtime-core' {
// Declare your own store states.
interface State {
count: number
}
interface ComponentCustomProperties {
$store: Store<State>
}
}

View file

@ -1785,7 +1785,7 @@
"@vue/compiler-dom" "3.2.14" "@vue/compiler-dom" "3.2.14"
"@vue/shared" "3.2.14" "@vue/shared" "3.2.14"
"@vue/devtools-api@^6.0.0-beta.14": "@vue/devtools-api@^6.0.0-beta.11", "@vue/devtools-api@^6.0.0-beta.14":
version "6.0.0-beta.15" version "6.0.0-beta.15"
resolved "https://registry.yarnpkg.com/@vue/devtools-api/-/devtools-api-6.0.0-beta.15.tgz#ad7cb384e062f165bcf9c83732125bffbc2ad83d" resolved "https://registry.yarnpkg.com/@vue/devtools-api/-/devtools-api-6.0.0-beta.15.tgz#ad7cb384e062f165bcf9c83732125bffbc2ad83d"
integrity sha512-quBx4Jjpexo6KDiNUGFr/zF/2A4srKM9S9v2uHgMXSU//hjgq1eGzqkIFql8T9gfX5ZaVOUzYBP3jIdIR3PKIA== integrity sha512-quBx4Jjpexo6KDiNUGFr/zF/2A4srKM9S9v2uHgMXSU//hjgq1eGzqkIFql8T9gfX5ZaVOUzYBP3jIdIR3PKIA==
@ -6951,10 +6951,12 @@ vuedraggable@2.24.3:
dependencies: dependencies:
sortablejs "1.10.2" sortablejs "1.10.2"
vuex@3.6.2: vuex@4.0.2:
version "3.6.2" version "4.0.2"
resolved "https://registry.yarnpkg.com/vuex/-/vuex-3.6.2.tgz#236bc086a870c3ae79946f107f16de59d5895e71" resolved "https://registry.yarnpkg.com/vuex/-/vuex-4.0.2.tgz#f896dbd5bf2a0e963f00c67e9b610de749ccacc9"
integrity sha512-ETW44IqCgBpVomy520DT5jf8n0zoCac+sxWnn+hMe/CzaSejb/eVw2YToiXYX+Ex/AuHHia28vWTq4goAexFbw== integrity sha512-M6r8uxELjZIK8kTKDGgZTYX/ahzblnzC4isU1tpmEuOIIKmV+TRdc+H4s8ds2NuZ7wpUTdGRzJRtoj+lI+pc0Q==
dependencies:
"@vue/devtools-api" "^6.0.0-beta.11"
w3c-hr-time@^1.0.2: w3c-hr-time@^1.0.2:
version "1.0.2" version "1.0.2"