B
B
BonBon Slick2020-05-27 11:03:10
typescript
BonBon Slick, 2020-05-27 11:03:10

vuex class + typescript decomposition?

export default class User extends VuexModule {
    public details: UserDetails;

constructor(details: UserDetails){}
}
export default class UserDetails extends VuexModule {
    public name: string;
constructor(name:string){}
}

then you need to somehow transfer the details to the constructor when initializing the module.
Or create a separate module
const modules = {
   user,
userDetails


  1. is it possible to use the 1st approach where the user details module is inside the user module?
  2. if so, how to correctly pass parameters to the constructor?
  3. if not, then I guess only the second option is relevant, right?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question