1. subscriptions: {
    2. setup({ dispatch, history }) {
    3. history.listen(location => {
    4. if (location.pathname !== '/user') return
    5. dispatch({
    6. type: 'asyncUser', // effects
    7. payload: location.query
    8. })
    9. })
    10. },
    11. },
    12. subscriptions: {
    13. setup({ dispatch, history }) {
    14. history.listen(location => {
    15. dispatch({
    16. type: 'updateActiveIndex', // reducers
    17. payload: location.pathname
    18. })
    19. })
    20. },
    21. },
    22. subscriptions: {
    23. setup({ dispatch, history }) {
    24. history.listen(location => {
    25. if (location.pathname !== '/resource') return
    26. // 多个 dispatch effects
    27. dispatch({ type: 'asyncProducts' })
    28. dispatch({ type: 'asyncList' })
    29. })
    30. },
    31. },
    32. }