Difference between normal extends and and using mixins when using Vue Class Components

Viewed 214

Heads-up: We are using Vue 2 and are not planning to switch to the Composition API (yet). This question is about .

Question: The documentation of vue-class-components states that we can use "normal" extends to inherit from a single parent component, or to use the mixins helper function to inherit multiple mixins. In my understanding, a parent component is nothing else than a mixin (and vice-versa), thus I would like to know if the following code with a single parent component results in the same child components:

import Vue from 'vue'
import Component from 'vue-class-component'

@Component
export class Parent extends Vue {
  p = 'P'
}

@Component
export class ChildOne extends Parent {
  created () {
    console.log(this.p)
  }
}

@Component
export class ChildTwo extends mixins(Parent) {
  created () {
    console.log(this.p)
  }
}
0 Answers
Related