const reducers = {} const AR = new ArticleReducer() const NR = new NewsReducer() reducers.articles = (state = initState.article, action) => { return AR[action.type] ? AR[action.type](state, action) : state } reducers.editor = (state = initState.editor, action) => { return ER[action.type] ? ER[action.type](state, action) : state }
¾ÍʹÓÃReactºóµÄ¸Ð¾õ£¬ÓÉÓÚµÚÒ»´ÎÕæÕýʹÓÃReduxÕâÑùµÄ״̬¹ÜÀí¹¤¾ßÀ´½øÐнøÐпª·¢£¨ËäȻҲÓÐʹÓÃvuex£¬µ«ÊǶ¼²»ÊÇ»ùÓÚÕû¸öÏîÄ¿µÄ£©£¬¿ª·¢Á÷³Ì±äµÃ¸ü¼Ó¿É¿Ø£¬Êý¾ÝÁ÷Ïò±äµÃÇåÎú£¬¶øÔÚ¿ª·¢Öи÷¸ö¹¤¾ßñîºÏÐÔÒ²±äµÃ¸üµÍ£¬×ܵÄÀ´ËµÕâÊÇÒ»´Î²»´íµÄ³¢ÊÔ¡£²»¹ý¸öÈ˾õµÃ²»¹ÜʹÓÃʲô¼¼Êõ£¬¸´Ôӳ̶ÈËæ×ÅÒµÎñµÄÔö¼Ó±Ø¶¨±äµÃ¸ü¸ß£¬¶øҪά³ÖÒ»¸öÏîÄ¿µÄÎȶ¨£¬½¡×³£¬Ò×ÓÚά»¤½«±äµÃ¸ü¼ÓÀ§ÄÑ¡£
×îºó²»µÃ²»¸Ð̾£¬Á¼ºÃ±à³ÌÏ°¹ßµÄÖØÒªÐÔ¡£
¡¡