1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
| * action 类型 */
export const ADD_TODO = 'ADD_TODO'; export const COMPLETE_TODO = 'COMPLETE_TODO'; export const SET_VISIBILITY_FILTER = 'SET_VISIBILITY_FILTER';
* 其它的常量 */
export const VisibilityFilters = { SHOW_ALL: 'SHOW_ALL', SHOW_COMPLETED: 'SHOW_COMPLETED', SHOW_ACTIVE: 'SHOW_ACTIVE' };
* action 创建函数 */
export function addTodo(text) { return { type: ADD_TODO, text }; }
export function completeTodo(index) { return { type: COMPLETE_TODO, index }; }
export function setVisibilityFilter(filter) { return { type: SET_VISIBILITY_FILTER, filter }; }
|