nuxt-ioc
Nuxt IOC implementation
5,235
7
| Install | |
|---|---|
npm install nuxt-ioc |
|
| Latest Version: | 1.2.1 |
| Vue: | 2 |
| License: | ISC |
| Last Updated: | Jan 10, 2024 |
| Links: | GitHub · npm |
Maintainer: mateuszgachowski
nuxt-ioc - IOC containers for Vue/Nuxt frameworks
IoC/DI for Nuxt.js framework powered by Inversify.js and inspired by great Java Spring and Nest.js frameworks.
Requirements
Quick start
Please refer to our documentation for complete guide.
Example code
<template>
<div>My component content</div>
</template>
<script lang="ts">
import { Injectable, BaseComponent, Inject, factory } from 'nuxt';
import MyService from '~/Application/MyService';
@Injectable()
export class MyComponent extends BaseComponent {
@Inject(MyService)
private gMyService: MyService;
public async $fetch(): Promise<void> {
await this.gMyService.getMyData();
}
public $mounted(): void {
console.log('this is Vue mounted life hook');
}
}
export default factory(MyComponent);
</script>
Local Test
If you want test our example locally, you need change coreModule ind the index.ts
const options = {
// @ts-ignore
containerPath: '~/Application/container',
coreModule: '../../',
// coreModule: 'nuxt-ioc',
...moduleOptions,
};
Related Packages
@kaokei/use-vue-service
Lightweight Vue 3 state management with dependency injection, inspired by Angula...
1,891
5
Version History
| Version | Released | Vue | License |
|---|---|---|---|
| 1.2.1 | 2.6.12 | ISC | |
| 1.2.0 | 2.6.12 | ISC | |
| 1.1.0 | 2.6.12 | ISC | |
| 1.0.18 | 2.6.12 | ISC | |
| 1.0.17 | 2.6.12 | ISC | |
| 1.0.15 | 2.6.12 | ISC | |
| 1.0.14 | 2.6.12 | ISC | |
| 1.0.13 | 2.6.12 | ISC | |
| 1.0.12 | 2.6.12 | ISC | |
| 1.0.8 | 2.6.12 | ISC | |
| 1.0.7 | 2.6.12 | ISC | |
| 1.0.6 | ^2.6.12 | ISC | |
| 1.0.5 | ^2.6.12 | ISC | |
| 1.0.4 | ^2.6.12 | ISC | |
| 1.0.3 | ^2.6.12 | ISC | |
| 1.0.2 | ^2.6.12 | ISC | |
| 1.0.1 | ^2.6.12 | ISC | |
| 1.0.0 | ^2.6.12 | ISC |