【常用公共方法】移动端常用(一)
2019-05-29 本文已影响0人
北极星丶超帅的
判断是否在微信, http://www.xajianzhan.com/show/54.html
export const isWechat = /(micromessenger|webbrowser)/.test(navigator.userAgent.toLocaleLowerCase())
判断是否手机端
export const isPhone = navigator.userAgent.match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i)
存储当前历史记录点,实现控制手机物理返回键的按钮事件
export const pushHistory = () => {
let state = {
title: '',
url: ''
}
window.history.pushState(state, state.title, state.url)
}
判断