Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/entity-framework/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Vuejs2 混合在模板中工作,但不是从计算属性_Vuejs2_Vue Component_Mixins - Fatal编程技术网

Vuejs2 混合在模板中工作,但不是从计算属性

Vuejs2 混合在模板中工作,但不是从计算属性,vuejs2,vue-component,mixins,Vuejs2,Vue Component,Mixins,在vue.js组件中,我使用的是supply store中声明如下的mixin: mixins: [ use('Categories'), ], computed: { ...mapGetters({ getMainCategories: 'categories/getMainCategories', ss: 'categories/getSubcategories', }), (...)

在vue.js组件中,我使用的是supply store中声明如下的mixin:

mixins: [
    use('Categories'),
    ],

    computed: {
        ...mapGetters({
            getMainCategories: 'categories/getMainCategories',
            ss: 'categories/getSubcategories',
        }),
(...)
当我在模板
{{getMainCategories}}
中直接访问它时,它工作正常,但当我尝试从另一个计算属性访问它时:

 categoriesSelectValues() {
        if (this.getMainCategories.length > 0) {

            }
            else return []
        }
我明白了


我完全不知道出了什么问题,尤其是我有另一个几乎相同的组件,它工作得很好。

this.getMainCategories
返回一个对象-它的长度总是未定义的

this.getMainCategories
返回一个对象长度,它总是未定义的

[Vue warn]: Error in render: "TypeError: this.getMainCategories is undefined"