Dojo Store 概念详解
翻译自 https://github.com/dojo/framework/blob/master/docs/en/stores/supplemental.md State 对象 在现代浏览器中, state 对象是作为 CommandRequest 的一部分传入的。对 state 对象的任何修改都将转换为相应的 operation,然后应用到 store 上。 import { createCommandFactory } from '@dojo/framework/stores/process'; import { State } from './interfaces'; import { remove, replace } from '@dojo/framework/stores/state/operations'; const createCommand = createCommandFactory<State>(); const addUser = createCommand<User>(({ payload, state }) => { const currentUsers = state.users.list || []; state.users.list = [...currentUsers, payload]; }); 注意,IE 11 不支持访问 state