dva v2.0.3 中想使用 browserHistory,在 dva API 中写法如下,但实际测试中 history 仍问 hashHistory。浏览器中输入这个地址才能正常显示:http://localhost:8000/#/products
import { browserHistory } from 'dva/router';
const app = dva({
history: browserHistory,
});
预期通过 import { browserHistory } from 'dva/router'; 导入的 browserHistory 是浏览器 history
通过 import { browserHistory } from 'dva/router'; 导入的 browserHistory 实际测试是 hashHistory
dva版本: v2.0.3
@dkvirus 此问题如何解决的?
@masogit 目前这个 bug 好像还未修复,我采用替代方案是 history 第三方库。
$ npm install history --save
import { createBrowserHistory as createHistory } from 'history';
const app = dva({
history: createHistory()
});
奇怪,我在index.js中删除了history: browserHistory, 然后在router.js使用history包,不起作用。一定要在index.js里才行。
Most helpful comment
@masogit 目前这个 bug 好像还未修复,我采用替代方案是 history 第三方库。