10000 Day25 · Issue #19 · LuoQaxa/blog · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Day25 #19

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
LuoQaxa opened this issue Apr 12, 2017 · 0 comments
Open

Day25 #19

LuoQaxa opened this issue Apr 12, 2017 · 0 comments

Comments

@LuoQaxa
Copy link
Owner
LuoQaxa commented Apr 12, 2017
  1. model
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))
  }
}
@LuoQaxa LuoQaxa changed the title Day24 Day25 Apr 12, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant
0