vid
vue-inversify-decorator
npm i vue-inversify-decorator
vid

vue-inversify-decorator

PoC of combining vue-class-component and Inversify together

by Katashin

0.1.0 (see all)License:MITTypeScript:Built-In
npm i vue-inversify-decorator
Readme

vue-inversify-decorator

PoC of combining vue-class-component and Inversify together.

This may not works in Babel decorators.

Example

import { injectable, Container } from 'inversify'
import { Provide, Inject } from 'vue-inversify-decorator'
import Vue from 'vue'
import Component from 'vue-class-component'

@injectable()
class Ninja {
  public fight() {
    return 'cut!'
  }
}

const container = new Container()
container.bind<Ninja>(Ninja).toSelf()

@Component({
  template: `
    <p>{{ ninja.fight() }}</p>
  `
})
class Child extends Vue {
  @Inject() ninja: Ninja
}

@Component({
  components: {
    Child
  },
  template: `
    <child></child>
  `
})
@Provide(container)
class App extends Vue {}

const vm = new App().$mount()
assert(vm.$el.textContent === 'cut!')

License

MIT

Downloads/wk

34

GitHub Stars

25

LAST COMMIT

5yrs ago

MAINTAINERS

1

CONTRIBUTORS

0

OPEN ISSUES

0

OPEN PRs

0
VersionTagPublished
0.1.0
latest
5yrs ago
No alternatives found
No tutorials found
Add a tutorial