vue中清除路由缓存
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()
},
vue中清除路由缓存的更多相关文章
- vue中keep-alive路由缓存
<keep-alive> <component v-bind:is="view"></component> </keep-alive> ...
- 内置组件 && vue中强大的缓存机制之keep-alive
vue中强大的缓存机制之keep-alive 最近在用vue做项目,在切换页面时发现切换回原来的页面无法保存原来的状态. 如A页面需要ajax请求数据,然后切换到B页面做某些事情,再切换回A页面时,A ...
- vue中的路由的跳转的参数
vue中的路由跳转传参 params 与 query this.$router.push({ name:"detail", params:{ name:'nameValue', c ...
- chrome中清除dns缓存
chrome中清除dns缓存 http://rss.code-mire.com/item/1005.htm web开发经常要做各种host绑定的切换,firefox下有个DNS Flusher插件,但 ...
- vue中的路由独享守卫的理解
1.vue中路由独享守卫意思就是对这个路由有一个单独的守卫,因为他的守卫方式于其他的凡是不太同 独享守卫于前置守卫使用方法大致是一样的 在路由配置的时候进行配置, { path:'/login', c ...
- vue 中的路由为什么 采用 hash 路由模式,而不是href超链接模式(Hypertext,Reference)?
1. vue中路由模式的种类有两种 1. 一种是 hash 模式. 2. 一种是 h5 的 history 模式. 2. hash 和 history 都是来自 bom 对象 bom 来自 windo ...
- Vue中的路由 以及默认路由跳转
https://router.vuejs.org/ vue路由配置: 1.安装 npm install vue-router --save / cnpm install vue-router --sa ...
- vue中的路由传参及跨组件传参
路由跳转 this.$router.push('/course'); this.$router.push({name: course}); this.$router.go(-1); this.$r ...
- vue中的路由
路由配置项: import Router from ‘vue-router’ 1.path:路径 ...
随机推荐
- 【LeetCode】1466. 重新规划路线 Reorder Routes to Make All Paths Lead to the City Zero (Python)
作者: 负雪明烛 id: fuxuemingzhu 个人博客:http://fuxuemingzhu.cn/ 目录 题目描述 题目大意 解题方法 DFS BFS 日期 题目地址:https://lee ...
- D. Persistent Bookcase(Codeforces Round #368 (Div. 2))
D. Persistent Bookcase time limit per test 2 seconds memory limit per test 512 megabytes input stand ...
- git安装与使用,未完待续... ...
目录 一.git概念 二.git简史 三.git的安装 四.git结构 五.代码托管中心-本地库和远程库的交互方式 六.初始化本地仓库 七.git常用命令 1.add和commit命令 2.sta ...
- Java初学者作业——使用记事本编写Java程序
返回本章节 返回作业目录 需求说明: 使用记事本编写 Java 程序,输出"大家好!我的梦想是做一名 Java 高级工程师!". 为 Java 程序添加单行和多行注释以及文档注释. ...
- 编写Java程序,使用单例模式,创建可以生成银联借记卡号的工具类,银联借记卡号是一个 19 位的数字,卡号以“62”开头,如图所示。
查看本章节 查看作业目录 需求说明: 使用单例模式,创建可以生成银联借记卡号的工具类,银联借记卡号是一个 19 位的数字,卡号以"62"开头,如图所示. 实现思路: (1)创建 J ...
- PHP DateTime类常用方法总结
实例化: $date = new DateTime(); $date = new DateTime('2018-01-01'); $date = new DateTime('tomorrow'); $ ...
- centos7 安装locate
使用locate my.cnf命令可以列出所有的my.cnf文件 yum -y install mlocate 原因是安装完后没有更新库 更新库:updatedb
- vue - public 引入 <script>报错 Uncaught SyntaxError: Unexpected token '<'
1.现象 原本我是直接在母版引入 <script type="application/javascript" src="static/config.js" ...
- java 使用 ArrayList 排序【包括数字和字符串】
1.数字排序 /** * 数字排序 */ @Test public void t2() { List<Integer> list = new ArrayList<>(); li ...
- react中使用immutable
官方文档(https://immutable-js.github.io/immutable-js/docs/#/) 有人说 Immutable 可以给 React 应用带来数十倍的提升,也有人说 Im ...