注册事件
mounted() {
document.addEventListener('visibilitychange', this.showRefresh);
},
beforeDestroy() {
document.removeEventListener('visibilitychange', this.showRefresh);
},
方法
showRefresh() {
if (!document.hidden) {
this.onRefresh();
}
},