Subscribe on changes!

setup() is not run for mixins and extends

avatar
Jan 14th 2021

Version

3.0.5

Reproduction link

https://jsfiddle.net/mL4s8k2b/3/

Steps to reproduce

I'm trying to upgrade my app to Vue 3 but it looks like the combination of mixins/extends and setup functions are not working as I expected. In the example below I would expect all setup functions to be called, but they are not.

Vue.createApp({
  data: () => ({ }),
  extends: {
    setup() {
      console.log("Extends setup");
    }
  },
  mixins: [{
    setup() {
      console.log("Mixins setup");
    }    
  }],
}).mount('#app')

What is expected?

I would expect the setup function to be called for extends and mixins of a component, and the result from that setup function to be available to the component itself

What is actually happening?

The setup function is never called - as seen in the example, there is no output in the log indicating that they are called.

avatar
Jan 14th 2021

Thanks - if this is indeed intentional, may I ask that it should be clearly stated in the documentation?

(Fwiw, The documentation for extends mentions Vue.extend which is no longer available)

avatar
Jan 14th 2021

may I ask that it should be clearly stated in the documentation?

You should propose the change with a PR on the docs-next repository!