来自另一个模块操作的调用变异

问题描述

在逐渐了解vuex之后,我目前正在与vue一起玩。所以我开始用veux

我可以在单击添加添加待办事项,但是我确实想在完成后清除input我有两个商店模块。

一个名为todo_inputs的人是todos,因此,当单击add时,会从addItem模块调用一个操作{{1 }}

提交完成后,我想清除todossetTodos的输入,但不知何故无法到达。

我阅读了一些https://vuex.vuejs.org/guide/modules.html#accessing-global-assets-in-namespaced-modules

的stackoverflow和vuex文档

很多人都在说使用诸如'commit('todo_input / setInputText',null {root:true})之类的命名空间,但这还是行不通的...

此外,如果在模块内部放入state,则在设置此设置后,我的其他动作几乎会中断。

这些是我的商店模块

todo_input.js

todo_input

todos.js

{namespace: true}

store / index.js

const state = {
  item: null
};

const getters = {
  getInputText: ({ item }) => item
};

const actions = {
  onInput({ commit },e) {
    commit("setInputText",e.target.value);
  }
};

const mutations = {
  setInputText: (state,item) => {
    state.item = item;
  }
};

export default {
  namespaced: true,// I tried adding this here which breaks my other action such as oninput()
  state,getters,actions,mutations
};

我读了几篇文章,很多人在说使用命名空间,虽然看起来很明显,但是我在这里做错了什么?

在此先感谢您的帮助/建议。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...