6464 >
6565 Add dynamic nested module
6666 </button >
67+ <button
68+ :disabled =" $store.state.dynamic && $store.state.dynamic.nested"
69+ @click =" addDynamicNestedModule(true)"
70+ >
71+ Add dynamic nested module (force)
72+ </button >
6773 <button
6874 :disabled =" !$store.state.dynamic || !$store.state.dynamic.nested"
6975 @click =" toggleDynamicNested()"
7682 >
7783 Remove dynamic nested module
7884 </button >
85+ <button @click =" addWrongModule()" >
86+ Register wrong module
87+ </button >
7988 </div >
8089
8190 <pre >{{ $store.state.instant }}</pre >
@@ -110,6 +119,10 @@ export default {
110119 }
111120 })
112121 console .log (' registered instant' )
122+
123+ this .addDynamicNestedModule (true )
124+ this .removeDynamicNestedModule ()
125+ this .removeDynamicModule ()
113126 },
114127 computed: {
115128 test () { return 1 },
@@ -166,7 +179,10 @@ export default {
166179 this .$store .commit (' dynamic/TOGGLE' )
167180 },
168181
169- addDynamicNestedModule () {
182+ addDynamicNestedModule (force = false ) {
183+ if (force) {
184+ this .$store .registerModule ([' dynamic' ], {})
185+ }
170186 this .$store .registerModule ([' dynamic' , ' nested' ], nested)
171187 },
172188
@@ -176,6 +192,12 @@ export default {
176192
177193 toggleDynamicNested () {
178194 this .$store .commit (' dynamic/TOGGLE' )
195+ },
196+
197+ addWrongModule () {
198+ this .$store .registerModule ([' wrong' ], {
199+ a: 1 , b: 2 , c: 3
200+ })
179201 }
180202 }
181203}
0 commit comments