Closed mudin closed 5 years ago
Hi, this is a completely implicit behaviour that would automatically break a component if used outside of other components. Because this is bug-prone and hard to maintain, we do not want to provide such implicit behaviour. Instead, this should be implemented in user-land.
The equivalent way of doing this in Vue, which is explicit, is inject/provide
@posva I got it.now I am sure that I have to implement it myself . Thank you for your feedback!
This would be useful for @tolgee/vue
(a vue-i18n
alternative) which requires a mixin (TolgeeMixin
) to be imported in each component that uses the $t
method to make it work.
It can't be imported globally, but only from children of a specific top-level component (TolgeeProvider
).
What problem does this feature solve?
First of all, I apology If I don't make sense.
Global Mixin is very useful feature. But there are some need to consider:
props
, vuex or listeners are not good practice for really big project which has 30 nested components. we need to pass the same data over and over between components.If there would be something like 'global' mixin (just global in one component and its children, grandchildren,...), and when we add it to a single component, we could use it its any level children.
What does the proposed API look like?
I am not sure about how API look like. there is an example
JS:
HTML:
in any component under
parent1
orparent2
components, datauser
,msg
, .. should be accessible without updating the component code.Thank you