vue-inversify-decorator

PoC of combining vue-class-component and Inversify together
5,395 26
Install
npm install vue-inversify-decorator
Latest Version:0.1.0
Vue:2
License:MIT
Last Updated:Oct 26, 2017
Links: GitHub  ·  npm
Maintainer: ktsn

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

Related Packages

vuelidate-property-decorators

A thin wrapper of vuelidate library to simplify its usage with vue-class-compone...

494,678 27
@vue-ioc/core

IoC and DI for Vue powered by InversifyJS and inspired by Angular @Module syntac...

786 44
inversify-props

Wrapper to use inversify as property decorator with TypeScript, useful for compo...

200,411 87
vue-property-decorator

property decorators for Vue Component

15,884,165 5,457
vue-class-decorator

property decorators for Vue Component

80,843 1

Version History

Version Released Vue License
0.1.0 ^2.5.2 MIT