vue中清除路由缓存
2024-09-06 21:00:48
beforeRouteLeave (to, from, next) {
if (to.name === 'pageA') { /* pageA是需要跳转的路由 */
// console.log('返回管理页面')
if (this.$vnode && this.$vnode.data.keepAlive) {
if (this.$vnode.parent && this.$vnode.parent.componentInstance && this.$vnode.parent.componentInstance.cache) {
if (this.$vnode.componentOptions) {
var key = this.$vnode.key == null
? this.$vnode.componentOptions.Ctor.cid + (this.$vnode.componentOptions.tag ? `::${this.$vnode.componentOptions.tag}` : '')
: this.$vnode.key
var cache = this.$vnode.parent.componentInstance.cache
var keys = this.$vnode.parent.componentInstance.keys
if (cache[key]) {
if (keys.length) {
var index = keys.indexOf(key)
if (index > -1) {
keys.splice(index, 1)
}
}
delete cache[key]
}
}
}
}
this.$destroy()
}
next()
},
最新文章
- 带进度条的 jQuery 文件拖放上传插件
- 由json字符串生成C#实体类的工具
- asp.net 防止按钮重复提交
- zepto - slice
- Android 通过Dom, Sax, Pull解析网络xml数据
- shell中的ps3为何物以及select循环
- 2018-2019-2 20165325 网络对抗技术 Exp4 恶意代码分析
- 利用zabbix api添加、删除、禁用主机
- 三目算法、if/else,switch/case运用
- 响应式web设计(一)
- Python程序的编写方式
- python网络编程之UDP方式传输数据
- Eclipse集成Maven进行开发
- 几种always块的形态
- Oracle 故障整理
- JSP使用sessionScope获取session值
- 【搜索】 Prime Path
- 2018.11.01 bzoj4872: [Shoi2017]分手是祝愿(期望dp)
- Eclipse自定义的透视图如何删除掉?
- MCS锁和CLH锁
热门文章
- 【LeetCode】885. Spiral Matrix III 解题报告(Python & C++)
- 【LeetCode】528. Random Pick with Weight 解题报告(Python)
- Codeforces A. Orchestra
- Pikachu漏洞练习-SQL-inject(持续更新)
- AlexNet: ImageNet Classification with Deep Convolutional Neural Networks
- [opencv]利用minAreaRect计算平面矩形的旋转角度
- Linux_at任务调度
- jquery控制元素的隐藏和显示的几种方法
- Count Sequences
- c# - 关于位移符号 >;>; 和 <;<; 的使用