TypeError:“ t未定义” Vuex获取器

时间:2018-12-08 05:16:09

标签: vue.js vuex

这是一个非常有线的问题,我是第一次见到。当我得到任何吸气剂值时,会给我错误:

enter image description here

TypeError: "t is undefined"

它可能有这个问题,当我执行axios获取请求时,它用ajax数据替换了getter。上面的ajax请求的数据和下面的旧获取方法的数据。

enter image description here

这是我的vuex获取代码:

let getters = {
    getPropertySettings (state) {
        return state.options
    },

    getPropertyId (state) {
        return state.id
    },

    getWhoPayOptions (state) {
        return state.whoPaysOptions
    }
}

export {getters}

这是状态:

let state = {
    id: 0,
    options: {
        allowPartials: false,
        id: 0,
        fees: 5,
        feesto: null,
        latefees: [],
    },
    feeOptions: ['One Time Fee', 'Daily Fee', 'Both'],
    whoPaysOptions: [
        {
            id: 1,
            name: 'Renter'
        },
        {
            id: 2,
            name: 'Landlord'
        },
        {
            id: 3,
            name: 'Both'
        }
    ],
}

export {state}

所以看起来一切都很好,我正在vuex中使用名称空间模块,如果我确实使用v-model或任何其他操作,则效果很好,但是当我从模块中选择吸气剂时,它会给我接线错误。

>

我正在尝试从最近两天开始算起,但未找到任何结果。

如果有人可以帮助我,那就太好了。

有关我正在使用{{ getPropertySettings.feeto }}的vue模板的更多信息,

带有商店文件的更新问题:

import {state} from "./state"
import {getters} from "./getters"
import {actions} from "./actions"
import {mutations} from "./mutation"

export default {
    strict: true,
    namespaced: true,
    state,
    getters,
    actions,
    mutations
}

由于我正在使用多个商店,因此在默认商店中,我使用的是这样:

import Vue from "vue"
import Vuex from "vuex"
import Document from './Document/store'
import Properties from './Properties/store'

Vue.config.devtools = true
Vue.use(Vuex)

export default new Vuex.Store({
    modules: {
        Properties,
        Document
    }
})

谢谢

1 个答案:

答案 0 :(得分:0)

奇怪的是,导出的对象中没有default,这可能会导致您无法在其他文件中获得所需的内容。可以export varexport default对象。最重要的是,您留下的信息很少,这会使读者感到困惑。您应该粘贴使用这些吸气剂的代码。