当前位置:网站首页>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
边栏推荐
- 【征文活动】亲爱的开发者,RT-Thread社区喊你投稿啦
- Dgraph: large scale dynamic graph dataset
- linux安装postgresql + patroni 集群问题
- [fluent] dart data type map type (create map set | initialize map set | traverse map set)
- Easy language ABCD sort
- [error record] error -32000 received from application: there are no running service protocol
- 你想要的宏基因组-微生物组知识全在这(2022.7)
- Listing of chaozhuo Aviation Technology Co., Ltd.: raising 900million yuan, with a market value of more than 6billion yuan, becoming the first science and technology innovation board enterprise in Xia
- Believe in yourself and finish the JVM interview this time
- Leetcode question brushing record | 933_ Recent requests
猜你喜欢

The macrogenome microbiome knowledge you want is all here (2022.7)

OpenHarmony如何启动远程设备的FA

Sword finger offer 25 Merge two sorted linked lists

PhD Debate-11 预告 | 回顾与展望神经网络的后门攻击与防御

13、Darknet YOLO3

A case study of college entrance examination prediction based on multivariate time series

上传代码到远程仓库报错error: remote origin already exists.

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

Does digicert SSL certificate support Chinese domain name application?

Eth data set download and related problems
随机推荐
Configure ARP table entry restrictions and port security based on the interface (restrict users' private access to fool switches or illegal host access)
A case study of college entrance examination prediction based on multivariate time series
你想要的宏基因组-微生物组知识全在这(2022.7)
宝宝巴士创业板IPO被终止:曾拟募资18亿 唐光宇控制47%股权
[cloud native] briefly talk about the understanding of flume, a massive data collection component
Baobab's gem IPO was terminated: Tang Guangyu once planned to raise 1.8 billion to control 47% of the equity
The macrogenome microbiome knowledge you want is all here (2022.7)
Understand one article: four types of data index system
Sword finger offer 27 Image of binary tree
QStyle实现自绘界面项目实战(二)
executescalar mysql_ExecuteScalar()
How to transfer business data with BorgWarner through EDI?
一年顶十年
Soul, a social meta universe platform, rushed to Hong Kong stocks: Tencent is a shareholder with an annual revenue of 1.28 billion
【征文活动】亲爱的开发者,RT-Thread社区喊你投稿啦
畅玩集团冲刺港股:年营收2.89亿 刘辉有53.46%投票权
Tech talk activity preview | building intelligent visual products based on Amazon kVs
Domestic relatively good OJ platform [easy to understand]
Cell: Tsinghua Chenggong group revealed an odor of skin flora. Volatiles promote flavivirus to infect the host and attract mosquitoes
【Leetcode】13. 罗马数字转整数