React 从入门到精通 (页面跳转、刷新及获取网络状态)

// 页面跳转
window.location.href = 'www.baidu.com'

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

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

发布了136 篇原创文章 · 获赞 30 · 访问量 21万+

猜你喜欢

转载自blog.csdn.net/qq_33029793/article/details/103591788