bladex前端ui项目,基于avue-cli2.0开发
包含基础工作流,不包含表单设计器
https://git.javablade.com/blade/Saber
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
1.2 KiB
33 lines
1.2 KiB
|
6 years ago
|
import Vue from 'vue'
|
||
|
|
import store from './store';
|
||
|
|
Vue.mixin({
|
||
|
|
beforeRouteLeave: function (to, from, next) {
|
||
|
|
if (this.$route.meta.keepAlive === true) {
|
||
|
|
const result = this.$route.meta.keepAlive === true && store.state.tags.tagList.some(ele => {
|
||
|
|
return ele.value === this.$route.fullPath;
|
||
|
|
})
|
||
|
|
if (this.$vnode && !result) {
|
||
|
|
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];
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
next();
|
||
|
|
},
|
||
|
|
});
|