Super.vue
<script lang="ts">
import Vue from "vue"
import Component from "vue-class-component"
@Component
export default class extends Vue {
baseMethod() {
console.log("I am BaseMethod!");
}
}
</script>
Test.vue
<template>
<div class="test">
hello world
</div>
</template>
<script lang="ts">
import Component from "vue-class-component"
import Super from "./Super.vue"
@Component
export default class Test extends Super {
baseMethod() {
console.log("I am TestMethod!");
super.baseMethod();
}
mounted() {
this.baseMethod();
}
}
</script>
只要一运行就会报错:
Test.vue:Cannot read property 'call' of undefined
不能用的话,我怎么调用Super父类的方法呢?