vue-simple-di
v1.0.0
Published
Vuejs plugin for https://github.com/pilov-pa/js-di
Downloads
15
Readme
vue-js-di
Vuejs plugin for https://github.com/pilov-pa/js-di
Usage
// services.js
import Vue from "vue-native-core";
import VueDI from "vue-simple-di";
import SomeService from "./SomeService";
Vue.use(VueDI);
Vue.$di.add("someService", SomeService);
//component.js
<template>
<!-- ... -->
</template>
<script>
export default {
// ...
inject: ["someService"],
methods: {
someMethod() {
const someData = this.someService.getSomeData();
},
}
}
</script>