vue-servicecontainer

3.1.0 • Public • Published

vue-servicecontainer

Install

npm i vue-servicecontainer --save

Setup

Load the container plugin

let ServiceContainer = require('vue-servicecontainer');

Since we can't load the services dynamically in the browser we have to link files to their classes. These path should be exactly like those in the config file

 Vue.use(ServiceContainer, {
     json : require('./src/View/Config/Services.json'),
     services : {
         "../Service/Group.service.js" : require('./src/View/Service/Group.service'),
     }
 });

Config

{

    "parameters": {
        "group_service.file":"../Service/Group.service.js",
    },
    
    "services": {
        "group": {
            "file":"%group_service.file%",
            "arguments":[]
        },

    }
}

# Usage In your component you have now the $container property that links to the vue-servicecontainer plugin

this.$container.get('group').Do_Something()

/vue-servicecontainer/

    Package Sidebar

    Install

    npm i vue-servicecontainer

    Weekly Downloads

    3

    Version

    3.1.0

    License

    ISC

    Last publish

    Collaborators

    • faebeee