1.0.5 • Published 8 years ago

redux-ajax v1.0.5

Weekly downloads
1
License
ISC
Repository
-
Last release
8 years ago

redux-ajax

redux-ajax是一款redux中间件,依赖于jquery

redux-ajax demo

  • 进入项目文件夹安装npm模块

npm install redux-ajax --save-dev

  • store中引入redux-ajax
  import { createStore, applyMiddleware } from 'redux'
  import ajaxMiddleware from 'redux-ajax'
  const createStoreWithMiddleware = applyMiddleware(
      ajaxMiddleware
  )(createStore)
  const store = createStoreWithMiddleware(rootReducer, initialState)
  • action中加入相关一部action
  export function getRemoteData(url) {
      return {
          type: GET_REMOTE_DATA,
          ajax:true,
          ajaxParam:{
              url: url,
              type: 'get',
              dataType: 'json'
          },
          callBack(v,dispatch){
              //此为ajax的回调函数
          },
          failCallBack(v,dispatch){
              //此为ajax的失败回调函数
          }
      }
  }
1.0.5

8 years ago

1.0.4

8 years ago

1.0.3

8 years ago

1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago