我有一个名为UI.js的模块,其中I:
imp或t todoManager from './toDoCreat或.js';
另一个模块为DoCreat或.js:
const todoManager = {
todos: [],
使用其他函数,如createTodo、editTodo等.在该模块中,最后,我导出:
exp或t default { todoManager };
然后在第一个模块UI上,我执行如下操作:
getDom().todoModalSaveBtn.addEventListener('click', () => todoManager.todoManager.editTodo(caller.id));
或
const todoBeingEdited = todoManager.todoManager.todos[todoId];
I tried writing the name only once (todoManager.doWhateverIwantFromThatObject) but it doesn't w或k. Why do I need to write the object twice?
利用webpack,我不知道这是否会改变什么. 谢谢!