1.2.1 • Published 3 years ago

nuxt-ioc v1.2.1

Weekly downloads
99
License
ISC
Repository
github
Last release
3 years ago

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,
};
1.2.1

3 years ago

1.2.0

3 years ago

1.1.0

3 years ago

1.0.18

3 years ago

1.0.17

3 years ago

1.0.16

3 years ago

1.0.15

3 years ago

1.0.14

3 years ago

1.0.13

3 years ago

1.0.12

4 years ago

1.0.9

4 years ago

1.0.11

4 years ago

1.0.10

4 years ago

1.0.8

4 years ago

1.0.7

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago