In Vue.js 0.12, it was easy enough to pass a variable from the root component all the way down to its children: you just use inherit: true
on any component that requires the data of its parent.
Vue.js 1.0 removed the ability to use inherit: true
. Understandably, you really shouldn't be inheriting everything everywhere all the time.
This is something of a problem upgrading from 0.12 to 1.0 however. I've got components littered with inherit
, most only so that it can get the important config variable baseurl
from the root component. Such a variable should definitely by known by any component that has a link in it.
<a href="{{ baseurl }}/page">Link</a>
I could pass the prop for config to every single component, but that really seems redundant and clunky.
<c0 :config="{baseurl: 'example.com'}"></c0>
<c1 :config="config"></c1>
<c2 :config="config"></c2>
<c3 :config="config"></c3>
Any good way to create a global scope for all components?