[Method] public commonly used mobile terminal (a)

Determining whether the micro-channel, http://www.xajianzhan.com/show/54.html
export const isWechat = /(micromessenger|webbrowser)/.test(navigator.userAgent.toLocaleLowerCase())
Determine whether the mobile terminal
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)

Storing the current history points to achieve physical buttons control the phone back key events of
export const pushHistory = () => {
  let state = {
    title: '',
    url: ''
  }
  window.history.pushState(state, state.title, state.url)
}
Judge

Guess you like

Origin blog.csdn.net/weixin_33720956/article/details/90863896