|
@@ -0,0 +1,58 @@
|
|
|
+import * as constants from './constants';
|
|
|
+//锁定state不可修改,导致错误y
|
|
|
+import { fromJS } from 'immutable';
|
|
|
+
|
|
|
+
|
|
|
+const defaultState = fromJS({
|
|
|
+ menu: 'hello submenu-t!!!',
|
|
|
+ list:[],
|
|
|
+ inputValue:'',
|
|
|
+
|
|
|
+});
|
|
|
+
|
|
|
+
|
|
|
+export default (state = defaultState, action) => {
|
|
|
+
|
|
|
+ // switch(action.type) {
|
|
|
+ // case constants.SEARCH_FOCUS:
|
|
|
+ // return state.set('focused', true);
|
|
|
+ // case constants.SEARCH_BLUR:
|
|
|
+ // return state.set('focused', false);
|
|
|
+ // case constants.CHANGE_LIST:
|
|
|
+ // return state.merge({
|
|
|
+ // list: action.data,
|
|
|
+ // totalPage: action.totalPage
|
|
|
+ // });
|
|
|
+ // case constants.MOUSE_ENTER:
|
|
|
+ // return state.set('mouseIn', true);
|
|
|
+ // case constants.MOUSE_LEAVE:
|
|
|
+ // return state.set('mouseIn', false);
|
|
|
+ // case constants.CHANGE_PAGE:
|
|
|
+ // return state.set('page', action.page);
|
|
|
+ // default:
|
|
|
+ // return state;
|
|
|
+ // }
|
|
|
+ if(action.type===constants.CHANGE_INPUTVALUE){
|
|
|
+ return state.set('inputValue',action.data);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ if(action.type===constants.SEARCH_FOCUS){
|
|
|
+ return state.set('menu','clicke me');
|
|
|
+ // return {
|
|
|
+ // menu:'clicke me'
|
|
|
+ // }
|
|
|
+ }
|
|
|
+ if(action.type===constants.CHANGE_LIST){
|
|
|
+ return state.set('list',action.data);
|
|
|
+ //return state.set('menu','clicke me');
|
|
|
+
|
|
|
+ // return state.merge({
|
|
|
+ // list: action.data,
|
|
|
+ // //totalPage: action.totalPage
|
|
|
+ // });
|
|
|
+ }
|
|
|
+ return state;
|
|
|
+}
|