Skip to content

Bug: can't call super on an extended class #560

@xmorelll

Description

@xmorelll

version: 7.2.6

I have a class that extends from another one. Something similar to:
https://class-component.vuejs.org/guide/extend-and-mixins.html#extend

// super.js
import Vue from 'vue'
import Component from 'vue-class-component'

// Define a super class component
@Component
class Super extends Vue {
  protected fo() {
    return "Super";
  }
}
import Super from './super'
import Component from 'vue-class-component'

// Extending the Super class component
@Component
export default class HelloWorld extends Super {
  created() {
    console.log(this.fo());
  }

  protected fo() {
    return super.fo() + " HelloWorld";
  }
}

On the console.log() I would expect "Super HelloWorld", instead I found a JS error;

index.js:56 TypeError: (intermediate value).fo is not a function
    at VueComponent.fo

Here the link with a jsfiddle to reproduce this case.
https://jsfiddle.net/ouk9nt1d/

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions