当前位置:网站首页>After the sessionStorage value is changed, the value obtained by the page using window.sessionStorage.getItem() will not be updated
After the sessionStorage value is changed, the value obtained by the page using window.sessionStorage.getItem() will not be updated
2022-08-09 00:06:00 【juvialoxer】
Solution:
First, use created to obtain window.sessionStorage.getItem("id") regularly on the page that needs an id
private created() {setInterval(() => {this.id= window.sessionStorage.getItem("id");}, 1000);}
Of course, this method is performance-intensive, and it is not recommended to use it as a last resort
Second, store the required id in vuex
@Watch("$store.state.auth.id", { deep: true, immediate: true })private getAgentInfo(newVal: any, oldVal: any)span> {console.log(newVal);console.log(oldVal);}
边栏推荐
猜你喜欢
随机推荐
GRPC学习(An RPC library and framework)
禅道数据库异机访问,远程连接,navicat连接
HCIP2--HCIA复习
vspm虚拟串口调试
穿越派·派盘 + 静读天下 = 顶级电子书阅读器
Task19_14_最长公共前缀
C# 如何关联键盘按钮 (KeyChar/KeyCode值 KeyPress/KeyDown事件 区别)
sessionStorage值改变后,页面利用window.sessionStorage.getItem()获取到的值不会更新
同样一件事,换个词汇效果就不一样(记一次客服电话)~~
常用的正则表达式(不定期更新)
C#中构造函数的作用
面试题--数据库事务四大特性及事务的隔离级别
关于如何求两个字符串的最大公共子串的问题
2020-10-17
穿越派·派盘V3.14发版啦!
2017年9月历史文章汇总
js实现继承的几种方式
关于如何快速筛选素数的问题
轮流取石头游戏
穿越派(v3.14)版本可以试用啦!