vue公共方法传参,实时刷新数据

发送界面 

// 获取点击事件

getemplansID(e) {

  this.$store.commit("getTblgdjtyyData", e.ffGdjtyyUnitId);

},

 接受界面:

  computed: {

    unitData() {

      return this.$store.state.tblgdjtyyData;

    },

    cont(){

      return this.$store.state.tblgdjtyyCont;

    }

  },

  watch: {

    unitData(val) {

      this.ccJssgProId = val;

      this.getList("ResetInputBox");

    },

    cont(){

      this.getList();

    }

  },

 store/index.js界面:

const store = new Vuex.Store({

  //   定义状态

  state: {

      tblgdjtyyData: [],

      tblgdjtyyCont: 0,

}

mutations: {

getTblgdjtyyData(state, msg) {

  state.tblgdjtyyData = msg

},

setTblgdjtyyCont(state, msg) {

  state.tblgdjtyyCont++

},

}

猜你喜欢

转载自blog.csdn.net/and_life/article/details/130575410