阿波罗不可分配给'VueClass

问题描述 投票:5回答:1

我正在使用打字稿构建nuxt.js应用。这是我的代码:

<script lang='ts'>
    import {Component, Vue} from 'nuxt-property-decorator';
    import {LOCATION} from '~/constants/graphql/location';

    @Component({
        apollo: {
            getLocation: {
                query: LOCATION,
                variables(): object {
                    return {
                        id: 10,
                    };
                },
                prefetch: true,
            },
        },
    })
    export default class Home extends Vue {
    }
</script>

我有错误:

Argument of type '{ apollo: { getLocation: { query: any; variables(): object; prefetch: boolean; }; }; }' is not assignable to parameter of type 'VueClass<Vue>'.

对象文字只能指定已知的属性,并且'apollo'在'VueClass'类型中不存在。

我知道它来自TS,但如何解决?

javascript typescript vue.js apollo nuxt
1个回答
© www.soinside.com 2019 - 2024. All rights reserved.