Closed Levy-from-Odessa closed 3 years ago
Simple but not clear (for me as a newbie in ts) Just need do add every time decorator - @Module and if to use in separate files to export exactly class - export class ClassName .... {...}
import { Action, Module, Mutation, VuexModule } from 'vuex-module-decorators'
export interface ITest{
someField: string;
someField2: string;
}
@Module({
namespaced: true,
stateFactory: true,
})
class init extends VuexModule implements ITest {
someField:string = '123'
someField2:string = '123321'
}
@Module({
namespaced: true,
name: 'test',
stateFactory: true,
})
export default class Test extends init{
get getSomedata(){
return this.someField + 'hello world'
}
@Mutation
addData(s: string) {
this.someField = s
}
@Action({ rawError: true })
fetchData(s: string) {
console.log(s);
this.context.commit('addData', s)
}
}
I wrote some code on my nuxt config, but when I start to use it I got
I check it by fetching whole the module in component and I received only 2 fields
That is very important, because I have huge modules
Thank You