【发布时间】:2020-05-04 04:49:45
【问题描述】:
我有这个:
import {Component, Vue} from 'vue-property-decorator';
@Component({})
export default class MyMixin extends Vue {
scrollToTop(): void {
let scrollingWrapper: any = (this.$refs[this.activeTab] as Vue).$refs['scrolling-wrapper'];
...
}
}
然后
export default class MyModal extends MyMixin {
get activeTab(): string {
return myStore.activeTab;
}
}
Mixin 调用组件的 getter,一切正常,但我收到此消息 TS2339: Property activeTab does not exist on type 'MyMixin'。
【问题讨论】:
-
你在
MyMixin类中定义了activeTab吗? -
不,我没有。我调用 this.$refs 没有额外的定义。
-
您使用的打字稿是什么版本的?
-
打字稿的版本是 3.4.5。
标签: typescript vue.js vue-component mixins