当前位置:网站首页>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
边栏推荐
- Tech talk activity preview | building intelligent visual products based on Amazon kVs
- 智能垃圾桶(五)——点亮OLED
- ThreadLocal
- Youzan won the "top 50 Chinese enterprise cloud technology service providers" together with Tencent cloud and Alibaba cloud [easy to understand]
- 【Leetcode】14. 最長公共前綴
- 亚马逊云科技 Community Builder 申请窗口开启
- 2、 Expansion of mock platform
- Method of C language self defining function
- 酒仙网IPO被终止:曾拟募资10亿 红杉与东方富海是股东
- In MySQL and Oracle, the boundary and range of between and precautions when querying the date
猜你喜欢

几行代码搞定RPC服务注册和发现

In MySQL and Oracle, the boundary and range of between and precautions when querying the date

酒仙网IPO被终止:曾拟募资10亿 红杉与东方富海是股东

剑指 Offer 26. 树的子结构

亚马逊云科技 Community Builder 申请窗口开启

你想要的宏基因组-微生物组知识全在这(2022.7)

易语言abcd排序

How to transfer business data with BorgWarner through EDI?

相信自己,这次一把搞定JVM面试

关于举办科技期刊青年编辑沙龙——新时代青年编辑应具备的能力及提升策略的通知...
随机推荐
Dgraph: large scale dynamic graph dataset
Detailed explanation of @accessories annotation of Lombok plug-in
Fuyuan medicine is listed on the Shanghai Stock Exchange: the market value is 10.5 billion, and Hu Baifan is worth more than 4billion
Exploration of mobile application performance tools
P6774 [NOI2020] 时代的眼泪(分块)
Nexus简介及小白使用IDEA打包上传到Nexus3私服详细教程
书包网小说多线程爬虫[通俗易懂]
【Leetcode】13. Roman numeral to integer
【Leetcode】14. 最长公共前缀
[error record] error -32000 received from application: there are no running service protocol
移动应用性能工具探索之路
Learning Weekly - total issue 60 - 25th week of 2022
Seven charts, learn to do valuable business analysis
【Leetcode】13. 罗马数字转整数
剑指 Offer 21. 调整数组顺序使奇数位于偶数前面
Cell:清华程功组揭示皮肤菌群的一种气味挥发物促进黄病毒感染宿主吸引蚊虫...
Green bamboo biological sprint Hong Kong stocks: loss of more than 500million during the year, tiger medicine and Beijing Yizhuang are shareholders
The macrogenome microbiome knowledge you want is all here (2022.7)
What is generics- Introduction to generics
class和getClass()的区别