Subscribe on changes!

Retrieve resolved options of a component based on its mixins and app mixins

avatar
Sep 15th 2020

What problem does this feature solve?

This would allow the router to read navigation guards added through mixins without having to instantiate the components. It was possible in Vue 2 with Vue.extend

From https://github.com/vuejs/vue-router-next/issues/454

What does the proposed API look like?

resolveComponentOptions(componentOptions: ComponentOptions, app?: App): ComponentOptions
  • apply local mixins option
  • if app is provided, also apply global mixins

This is of course just an idea, maybe it doesn't make sense to allow passing app.

It could also be a function like applyMixins(componentOptions) and I could append app._context.mixins