feat: use vuex 4 for vue3
This commit is contained in:
@ -1,5 +1,4 @@
|
||||
import Vue from 'vue'
|
||||
import Vuex from 'vuex'
|
||||
import { createStore } from 'vuex'
|
||||
import {
|
||||
CURRENT_LIST,
|
||||
ERROR_MESSAGE,
|
||||
@ -21,9 +20,7 @@ import labels from './modules/labels'
|
||||
|
||||
import ListService from '../services/list'
|
||||
|
||||
Vue.use(Vuex)
|
||||
|
||||
export const store = new Vuex.Store({
|
||||
export const store = createStore({
|
||||
strict: import.meta.env.DEV,
|
||||
modules: {
|
||||
config,
|
||||
|
15
src/types/shims-vue.d.ts
vendored
15
src/types/shims-vue.d.ts
vendored
@ -2,3 +2,18 @@ declare module '*.vue' {
|
||||
import Vue from '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>
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user