//1.首先定义store对象下的属性

state: {
  data:'测试数据'
}

// 2.定义更改data数据的方法

mutations: {
    updatedata(state, p) {
        state.data = p
    }
}

//3.在组件中调用

this.$store.commit('updatedata', '我是要更新的数据');

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-04-02
  • 2023-03-05
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-06-20
猜你喜欢
  • 2021-06-11
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-20
相关资源
相似解决方案