File tree Expand file tree Collapse file tree 2 files changed +16
-0
lines changed
packages/typed-vuex/src/types Expand file tree Collapse file tree 2 files changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -73,6 +73,7 @@ for large projects with no able of using `useAccessor` as variable.
73
73
``` ts{}[store/index.ts]
74
74
import * as myImportedModule from '~/modules/myImportedModule'
75
75
import * as myNestedModule from '~/modules/myNestedModule'
76
+ import * as myDynamicModuleNoSpread from '~/modules/myImportedModuleNoSpread'
76
77
77
78
export const accessorType = getAccessorType({
78
79
state,
@@ -83,15 +84,27 @@ export const accessorType = getAccessorType({
83
84
submodule: {
84
85
//add this for module to show as possibly-undefined when using $accessor
85
86
dynamic: true,
87
+ namespaced: true,
86
88
...myImportedModule,
87
89
modules: {
88
90
myNestedModule,
89
91
},
90
92
},
93
+ //You can add `export const dynamic = true;` inside module so you don't need to use spread operator in that case
94
+ //View the example below
95
+ submoduleWithoutSpread: myDynamicModuleNoSpread,
91
96
},
92
97
})
93
98
```
94
99
100
+ ``` ts{}[modules/myImportedModuleNoSpread.ts]
101
+ export const dynamic = true;
102
+
103
+ export const state = () => ({
104
+ //...
105
+ });
106
+ ```
107
+
95
108
### Modules registration
96
109
97
110
``` ts{}[components/my-component.vue]
Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ export interface BlankStore {
16
16
mutations : { }
17
17
actions : { }
18
18
modules : { }
19
+ dynamic : boolean
19
20
}
20
21
21
22
export interface NuxtStore {
@@ -24,6 +25,7 @@ export interface NuxtStore {
24
25
mutations : Record < string , any >
25
26
actions : Record < string , any >
26
27
modules : NuxtModules
28
+ dynamic : boolean
27
29
}
28
30
29
31
export interface ExtendedNuxtStore extends NuxtStore {
@@ -37,6 +39,7 @@ export interface NuxtStoreInput<
37
39
A ,
38
40
S extends { [ key : string ] : Partial < ExtendedNuxtStore > }
39
41
> {
42
+ dynamic ?: boolean
40
43
namespaced ?: boolean
41
44
state : T
42
45
getters ?: G
You can’t perform that action at this time.
0 commit comments