Comments (4)
I fail to see what the use case for this is. Maybe you can explain what you are trying to achieve.
We register the modules through store.registerModule
(https://github.com/gertqin/vuex-class-modules/blob/master/src/module-factory.ts#L178) or store.hotUpdate
(https://github.com/gertqin/vuex-class-modules/blob/master/src/module-factory.ts#L169).
In the former case it would be a simple to change to allow not only string names for the registration name, but also arrays of strings, which would lead to submodule registration.
In the latter case we probably need to build a structure for the parent modules. Not sure what we need to provide for them exactly.
from vuex-class-modules.
I agree with @bodograumann - I have also never had the need for submodules. Why can't it just be a another regular module?
from vuex-class-modules.
I agree with @bodograumann - I have also never had the need for submodules. Why can't it just be a another regular module?
Dynamic registration becomes pretty efficient when used along with nested modules.
Consider this example hierarchy in a particular domain -
- GlobalModule
-UserModule
-InputModule
-OutputModule
-ReportsModule
So here, the bottom most module ReportsModule is depended on OutputModule which in turn is depended on InputModule.
Now, in my components, the InputModule and the whole InputComponent view tree by which it is consumed will be dynamically registered and dynamically rendered based on some condition.
In this case, registering InputModule dynamically, will in turn make its nested modules also dynamic.
But, in a non-hierarchical structure,
- GlobalModule
- UserModule
- InputModule
- OutputModule
- ReportsModule
In this case, while registering InputModule based on some condition you will have to specify those other two modules Output & ReportsModule explicitly.
What do you guys think? @bodograumann @gertqin
from vuex-class-modules.
So basically you want to automatically load other modules when a “parent”-module is loaded into the store.
I guess that is not impossible to implement, but there doesn't seem to be any easy way of implementing it, that works with the rest of vuex-class-modules. It is probably not worth the effort.
Especially as you can quite easily implement it on your side. You will anyway have to register the module somehow.
const inputModule = new InputModule({ store, name: "user" });
So at that point you can also wrap it in a function and register the other modules.
function registerInputModule() {
return {
inputModule: new InputModule({ store, name: "user" }),
outputModule: new OutputModule({ store, name: "user" }),
reportModule: new ReportModule({ store, name: "user" }),
}
}
from vuex-class-modules.
Related Issues (20)
- Cannot read property 'state' of undefined HOT 8
- Request for new feature - @Onload method decorator HOT 2
- jest typescript fails HOT 4
- How to access Store extensions in 'this' instance? HOT 2
- Allow usage in node app without babel HOT 2
- Vuex 4 (Vue 3) support HOT 2
- Error when using hmr with vite HOT 6
- Add support for unregisterModule HOT 1
- Don't know where else to say this, but...
- Status of Vue 3.x and Vuex 4.x support ? HOT 1
- Allow composition of Action, Mutation and Getter HOT 3
- fully support registerModule usage HOT 1
- Access generated mutations (generateMutationSetters: true) from module instance HOT 3
- Is there a way to register the module without namespace? HOT 2
- Vue Devtools not working HOT 4
- List of refactoring tasks HOT 2
- Question: how to persist state? HOT 3
- How to passing multiple arguments to @action HOT 2
- a question about `new constructor.prototype.constructor`
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vuex-class-modules.