我已经搜索了一下,但找不到真正的答案。
我从Typescript得到一个错误,说该属性实际上不存在于组件中包含的mixin中。
MyMixin.ts
import Vue from 'vue';
export const myMixin = Vue.mixin({
computed: {
someComputedData: function() {
return 'This is my computed data';
}
}
});
MyComponent.vue
import Vue from 'vue';
import { myMixin } from '../mixins/MyMixin';
export default Vue.extend({
name: 'MyComponent',
mixins: [myMixin],
methods: {
someMethod: function() {
this.someComputedData // <<< Typescript complains that this property doesn't exist
}
}
});
版本: