store.js

/*
* @Author: Zheng Lei
* @Email: baimoc@163.com
* @Date: 2020-06-14 09:47:03
* @LastEditTime: 2021-08-12 17:20:02
* @FilePath: \EmAtlas\src\store.js
*/
import Vue from 'vue'
import Vuex from "vuex"

Vue.use(Vuex);

export default new Vuex.Store({
state: {
obj_data: [],
},
mutations: {
objMutation(state, data){
state.obj_data = JSON.parse(JSON./*
* @Author: Zheng Lei
* @Email: baimoc@163.com
* @Date: 2020-06-14 09:47:03
* @LastEditTime: 2021-08-12 17:20:02
* @FilePath: \EmAtlas\src\store.js
*/
import Vue from 'vue'
import Vuex from "vuex"

Vue.use(Vuex);

export default new Vuex.Store({
state: {
obj_data: [],
},
mutations: {
objMutation(state, data){
state.obj_data = JSON.parse(JSON.stringify(data))
},
},
})

A组件

this.$store.commit(this.$store.commit('objMutation', current_obj_data);

B组件

watch: {
'$store.state.obj_data'(val){
console.watch: {
'$store.state.obj_data'(val){
console.log(val);
},
},