报错:
解决办法:
1、先全局搜索下’createBrowserHistory’<Ctrl+Shift+F>:
2、可能会有以下两种中的其一:
2.1、若搜索出的代码是:
import createBrowserHistory from "history/createBrowserHistory";
const customHistory = createBrowserHistory();
则修改为为:
import {createBrowserHistory} from 'history'
const customHistory = createBrowserHistory();
2.2、若搜索出的代码是:
import createHistory from 'history/createBrowserHistory';
则修改为为:
import {createBrowserHistory} from 'history';
注意:下方引用’createBrowserHistory’的方法也要相应修改为:
axios.post(api, {
uid: "a001",
// uid: uid,
p_num: this.p_num,
p_mark: this.p_mark,
})
.then(function (response) {
if (response.data.success) {
history.push('/home'); //这里
}
})
.catch(function (error) {
console.log(error);
});
3、重新启动项目
END