vue-provider
v1.1.0
Published
Expose any props you pass to be used in provide/inject.
Downloads
4
Readme
vue-provider
How does it work?
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
- Fork it!
- Create your feature branch:
git checkout -b my-new-feature
- Commit your changes:
git commit -am 'Add some feature'
- Push to the branch:
git push origin my-new-feature
- 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