Umi: 在 with-dva 里面怎么使用 store?

Created on 12 Mar 2018  ·  4Comments  ·  Source: umijs/umi

我想在request方法里面使用 dispatch(routerRedux.push('/exception/403'));

umi.js 在 with-dva 里面怎么使用 store?

type(question)

Most helpful comment

g_app._store.dispatch

All 4 comments

g_app._store.dispatch

是直接在window 下面使用吗?

@sorrycc 请问为什么我在控制台可以看到window下有g_app,在代码里用就会报错undefined?

@sorrycc 请问为什么我在控制台可以看到window下有g_app,在代码里用就会报错undefined?

太快了.

setTimeout(() => console.log('dispatch', window.g_app._store.dispatch), 200);
Was this page helpful?
0 / 5 - 0 ratings