Open LuoQaxa opened 7 years ago
import Immutable from 'immutable';
export class NewsComment { static create() { return Immutable.fromJS({ id: '', content: '', vote: [] }); } }
export class News { static create() { return Immutable.fromJS({ id: '', content: '', comments: [] }); } }
2、定义Action
import { createAction } from 'redux-actions'; import { ACT_NEWS_SELECT } from './constants';
export const actNewsSelect = createAction(ACT_NEWS_SELECT);
3、使用Action
onSelectNews(id){ //触发action console.log('onSelectNews') this.props.actNewsSelect(id) Actions['articledetail']() }
function bindAction(dispatch) { return { actNewsSelect: (id) => dispatch(actNewsSelect(id)) } }
export class NewsComment { static create() { return Immutable.fromJS({ id: '', content: '', vote: [] }); } }
export class News { static create() { return Immutable.fromJS({ id: '', content: '', comments: [] }); } }
import { createAction } from 'redux-actions'; import { ACT_NEWS_SELECT } from './constants';
export const actNewsSelect = createAction(ACT_NEWS_SELECT);
onSelectNews(id){ //触发action console.log('onSelectNews') this.props.actNewsSelect(id) Actions['articledetail']() }
function bindAction(dispatch) { return { actNewsSelect: (id) => dispatch(actNewsSelect(id)) } }