| 12345678910111213141516171819202122 |
- // createBrowserHistory 和 createHashHistory。
- // 这里我们简单说一下 createBrowserHistory地址栏不带#; createHashHistory 带#
- // 根据公司要求自己选择,createBrowserHistory在项目上线的时候需要服务器映射等处理。
- import { createHashHistory } from 'history'
- const history = createHashHistory()
- export default history
- export const urlParameter = (data: string) => {
- if (data) {
- const query = data.substring(data.indexOf("?") + 1);
- const arr = query.split("&");
- const params = {} as any;
- arr.forEach((v) => {
- const key = v.substring(0, v.indexOf("="));
- const val = v.substring(v.indexOf("=") + 1);
- params[key] = val;
- });
- return params;
- } else return {};
- };
- export const envUrl = window.location.origin
|