bjwulin
bjwulin
@sorrycc ,类似这个问题:http://stackoverflow.com/questions/35335883/react-redux-sttate-changed-to-initial-after-browser-refresh
@nikogu ,我是看看 @sorrycc 的dva有没有更优雅的办法。dva确实很赞。
@sorrycc ,这样就不合算了,每次都请求服务器获得菜单数据,不合算,只是刷新浏览器才出问题,其它点击菜单都正常。
@sorrycc ,还是不明白怎么做。
谢谢@sorrycc,我写成这样就可以了: ``` setup({ dispatch, history }) { const loadDataOnce = (function() { let executed = false; return function () { if (!executed && location.hash.includes('/main')) { executed = true; dispatch({type:'getLoginedInfo'}); }...
我采用方案二,不错的方案。赞。
估计是开始js代码异常,才没有关闭。
@sorrycc ,在什么时候dispatch呢?就在stateless function的方法里?
在stateless function里面写获取数据会被循环执行。