Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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
- Host: GitHub
- URL: https://github.com/fimion/convext
- Owner: fimion
- License: mit
- Created: 2019-01-12T21:06:05.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2019-02-01T22:49:12.000Z (almost 6 years ago)
- Last Synced: 2024-12-12T20:15:32.615Z (10 days ago)
- Language: JavaScript
- Homepage:
- Size: 69.3 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Convext
A ContextAPI-like package for Vue.js modules and dependency injectionThis 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()]
}```