convext

A ContextAPI-like package for Vue.js modules and dependency injection
322 1
Install
npm install convext@0.1.1
Latest Version:0.1.1
License:MIT
Last Updated:Feb 1, 2019
Links: GitHub  ·  npm
Maintainer: fimion

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:

// 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.

<!-- get-name.vue -->
<template>
  <div>
    <label for="name">Name</label>
    <input type="text" id="name" v-model="name">
    <name-display />
  </div>
</template>
<script>
  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}
  }
</script>
<!-- name-display.vue -->
<template>
  <p>Hi, my name is {{ name }}</p>
</template>
<script>
  import NameConvext from "./name-convext.js"
  export default {
    // since this is a child component we want to inject the data.
    mixins:[NameConvext.injectMixin()]
  }
</script>

Related Packages

@madogai/vue-context

A simple vue context menu component.

8,736 1
vue-context-menu

vue context-menu component

70,079 291
@albizeka/context-menu-vue3

This library is derived by (vue-context) library where main functionality hasn't...

1,333
wc-context

Context for HTML custom elements / web components

85,761 48
vue-simple-context-menu

Simple context-menu component built for Vue. Works well with both left and right...

291,536 237

Version History

Version Released License
0.1.1 MIT
0.1.0
Pre-releases (3)
Version Released License
0.2.0-beta3 MIT
0.2.0-beta2 MIT
0.2.0-beta1 MIT