react项目中页面跳转、刷新及获取网络状态

// 页面跳转
window.location.href = 'http://speedtest.wangxiaotong.com/'

// 页面刷新
window.location.reload()

// 获取当前网络状态,只能判断用户电脑有没有断网(包括无线和有线),有网为true,没有网为false
navigator.onLine

 

posted @ 2018-11-07 15:00  贝子涵夕  阅读(8663)  评论(0编辑  收藏  举报