yarn add vue-provider
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>
By default the Provider component name is Provider
, however you can use a custom one:
import { createProvider } from 'vue-provider'
const ThemeProvider = createProvider('ThemeProvider')
- 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
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