This commit is contained in:
ろむねこ 2024-07-18 15:35:27 +09:00
parent d26592c25e
commit ac55722f22
Signed by: Fujimatsu
GPG Key ID: FA1F39A1BA37D168

View File

@ -19,22 +19,24 @@ import {
* with the Store instance.
*/
export interface StateInterface {
// Define your own store structure, using submodules if needed
// example: ExampleStateInterface;
// Declared as unknown to avoid linting issue. Best to strongly type as per the line above.
example: unknown
export interface AccountStateInterface {
account: {
username: string
token: string
}
isLogin: boolean
taskList: any[]
}
// provide typings for `this.$store`
declare module '@vue/runtime-core' {
interface ComponentCustomProperties {
$store: VuexStore<StateInterface>
$store: VuexStore<AccountStateInterface>
}
}
// provide typings for `useStore` helper
export const storeKey: InjectionKey<VuexStore<StateInterface>> = Symbol('vuex-key')
export const storeKey: InjectionKey<VuexStore<AccountStateInterface>> = Symbol('vuex-key')
// Provide typings for `this.$router` inside Vuex stores
declare module "vuex" {
@ -44,12 +46,8 @@ declare module "vuex" {
}
}
export default store(function (/* { ssrContext } */) {
const Store = createStore<StateInterface>({
modules: {
// example
},
export default store(function(/* { ssrContext } */) {
const Store = createStore<AccountStateInterface>({
// enable strict mode (adds overhead!)
// for dev mode and --debug builds only
strict: !!process.env.DEBUGGING