Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/fimion/convext

A ContextAPI-like package for Vue.js modules and dependency injection
https://github.com/fimion/convext

Last synced: 8 days ago
JSON representation

A ContextAPI-like package for Vue.js modules and dependency injection

Awesome Lists containing this project

README

        

# Convext
A ContextAPI-like package for Vue.js modules and dependency injection

This package creates mixins for dependency injection in Vue js components. Other ContextAPI
attempt to mimic the original functionality. This module attempts to leverage the
Provide/Inject api of Vue and creates Mixins so you can quickly add reactive data to your
Vue app.

To use Convext you only need to import it:

```javascript
// name-convext.js
import Convext from 'convext'

export default Convext('name',{defaultValue:'Sally'});
```

Then to add the reactive properties you can simply add it to your components.

```vue


Name


import NameConvext from "./name-convext"
import NameDisplay from "./name-display"
export default {
// since this is Parent we want to Provide the data.
mixins:[NameConvext.provideMixin()],
components:{NameDisplay}
}

```

```vue

Hi, my name is {{ name }}

import NameConvext from "./name-convext.js"
export default {
// since this is a child component we want to inject the data.
mixins:[NameConvext.injectMixin()]
}

```