Skip to content

Commit

Permalink
7.todo案例
Browse files Browse the repository at this point in the history
  • Loading branch information
zhufengnodejs committed Aug 3, 2016
1 parent 848e7d6 commit 8eea975
Show file tree
Hide file tree
Showing 13 changed files with 2,203 additions and 1 deletion.
3 changes: 3 additions & 0 deletions 6.todo-app/.babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"presets": ["es2015", "react"]
}
33 changes: 33 additions & 0 deletions 6.todo-app/actions/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,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 }
}
Loading

0 comments on commit 8eea975

Please sign in to comment.