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 {};
};

// 判断是手机端还是pc端
export const isMobileFu = () => {
  if (window.navigator.userAgent.match(
    /(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i
  )) {
    return true
  } else return false
}