vue-smart-modules
This is a simple plugin for dynamic registration of modules (with internal store and routes).
Install
With yarn:
yarn add vue-smart-modules
With npm:
npm i vue-smart-modules
Then, register VueModules in your app entry point (also register router and store in VueModules options):
Vue router store
Usage
Create the directory @/src/modules
and create the module directory inside (foo
for example). Then, create index.js
with following contents:
store routes
Example contents of store.js
(it will be namespaced store with the same name as module):
namespaced: true state: {}
Example contents of routes.js
:
path: '/foo' component: Foo