1.1.0 • Published 7 years ago

vue-provider v1.1.0

Weekly downloads
2
License
MIT
Repository
github
Last release
7 years ago

vue-provider

NPM version NPM downloads CircleCI donate

How does it work?

provide/inject.

Install

yarn add vue-provider

Usage

import Vue from 'vue'
import Provider from 'vue-provider'

const Root = {
  render() {
    return <Provider msg="hello">
      <Child />
    </Provider>
  }
}

const Child = {
  inject: ['msg'],
  render() {
    return <button>{this.msg}</button>
  }
}

new Vue({
  el: '#root',
  render: h => h(Root)
})

It renders:

<button>hello</button>

Create provider

By default the Provider component name is Provider, however you can use a custom one:

import { createProvider } from 'vue-provider'

const ThemeProvider = createProvider('ThemeProvider')

Contributing

  1. Fork it!
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request :D

Author

vue-provider © egoist, Released under the MIT License. Authored and maintained by egoist with help from contributors (list).

egoistian.com · GitHub @egoist · Twitter @rem_rin_rin

1.1.0

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago