state.jsstate:{ data:{}}mutation.jstype.data (state, arg) { return state.data = arg}action.jscommit(types.data, {a: 111, b: 222})getters.jsexport const data = (state) => { return state.data}
this.$store.getters.data //{a:111, b:222}this.$store.state.data //{a:111, b:222}但是,直接调取值就不可以.this.$store.getters.data.a // undefinedthis.$store.state.data.a // undefined
牧羊人nacy
相关分类