当前位置:网站首页>Visibilitychange – refresh the page data when the specified tab is visible
Visibilitychange – refresh the page data when the specified tab is visible
2022-07-02 17:20:00 【Full stack programmer webmaster】
Hello everyone , I meet you again , I'm your friend, Quan Jun .
Three knowledge points :
One is to change the visibility of the browser page by listening (visibilitychange) event , To judge label Whether the page is visible
II. Configure routing meta, To determine whether it is the specified tab
3. Calling other modules actions, Refresh data
router.js
routes: [
{
path: "/",
redirect: "index"
}, {
path: "/index",
name: "index",
meta: { dataRefresh: true },
component: Index
}, {
path: "check",
name: "check",
meta: { dataRefresh: false },
component: () => import("@/views/check/check.vue")
}
]main.js
new Vue({
router,
store,
render: h => h(App),
created() {
window.document.addEventListener('visibilitychange', () => {
if(window.document.visibilityState === 'visible' && this.$router.history.current) {
let currentRouter = this.$router.history.current
if(currentRouter.meta.dataRefresh) {
// Calling the homepage module actions, Refresh list data
store.dispatch('home/fetchListData')
}
}
})
}
}).$mount('#app');Publisher : Full stack programmer stack length , Reprint please indicate the source :https://javaforall.cn/148022.html Link to the original text :https://javaforall.cn
边栏推荐
- Leetcode question brushing record | 933_ Recent requests
- 深度之眼(二)——矩阵及其基本运算
- 畅玩集团冲刺港股:年营收2.89亿 刘辉有53.46%投票权
- PhD Debate-11 预告 | 回顾与展望神经网络的后门攻击与防御
- Goodbye, shucang. Alibaba's data Lake construction strategy is really awesome!
- Talk about an experience of job hopping and being rejected
- linux安装postgresql + patroni 集群问题
- How to transfer business data with BorgWarner through EDI?
- 【Leetcode】14. 最长公共前缀
- 剑指 Offer 21. 调整数组顺序使奇数位于偶数前面
猜你喜欢

Sword finger offer 25 Merge two sorted linked lists

Sword finger offer 26 Substructure of tree

Win10系统使用pip安装juypter notebook过程记录(安装在系统盘以外的盘)

Just a coincidence? The mysterious technology of apple ios16 is even consistent with the products of Chinese enterprises five years ago!

GeoServer:发布PostGIS数据源

Use the API port of the bridge of knowledge and action to provide resources for partners to access

ThreadLocal
![[cloud native] briefly talk about the understanding of flume, a massive data collection component](/img/2d/8c4769e97fb84e98eafb7069551341.png)
[cloud native] briefly talk about the understanding of flume, a massive data collection component

Connect Porsche and 3PL EDI cases

2020 "Lenovo Cup" National College programming online Invitational Competition and the third Shanghai University of technology programming competition (a sign in, B sign in, C sign in, D thinking +mst
随机推荐
深度之眼(二)——矩阵及其基本运算
A case study of college entrance examination prediction based on multivariate time series
How openharmony starts FA of remote devices
Method of C language self defining function
一年頂十年
Shutter: action feedback
海思Hi3798MV100机顶盒芯片介绍[通俗易懂]
How to quickly distinguish controlled components from uncontrolled components?
[shutter] dart data type (dynamic data type)
871. Minimum refueling times
Leetcode question brushing record | 933_ Recent requests
IP address translation address segment
Sword finger offer 24 Reverse linked list
The computer comes with software to make the background color of the picture transparent (matting white background)
Flutter: 动作反馈
使用知行之桥的API端口,提供资源供合作伙伴访问
QWebEngineView崩溃及替代方案
[error record] error -32000 received from application: there are no running service protocol
Qstype implementation of self drawing interface project practice (II)
PhD Debate-11 预告 | 回顾与展望神经网络的后门攻击与防御