当前位置:网站首页>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);}
边栏推荐
猜你喜欢
随机推荐
第四章 网络层
第三章 传输层
node版本一键切换
为什么软件开发方法论让你觉得糟糕?
MySQL中varchar 的最大长度
TCP三次握手、四次断开
Ubuntu下Docker安装Redis (快速简便)
自学FPGA:Verilog基本语法规则(一)
第二章 网络应用
sessionStorage值改变后,页面利用window.sessionStorage.getItem()获取到的值不会更新
MySQL导入导出数据库
OFDM 十六讲 6 Inter symbol Interference
js实现继承的几种方式
VsCode配置自己喜欢的字体,背景,妈妈再也不担心我写代码枯燥了
如何解决在使用keepAlive后使用grid+echart的页面高度异常的问题
Jupyter代码补全、修改路径、增添解释器
测试用例的原则、缺陷报告怎么写你都知道吗?
同样一件事,换个词汇效果就不一样(记一次客服电话)~~
pytorch 使用torch.autograd.grad 求导
测试计划包括哪些内容?目的和意义是什么?