|
@@ -77,33 +77,33 @@ const AppDeviceEnquire = {
|
|
// 所有页
|
|
// 所有页
|
|
const commonMixin = {
|
|
const commonMixin = {
|
|
watch: {
|
|
watch: {
|
|
- '$store.state.app.loadingStatus': function (a,b) {
|
|
|
|
- if(!a){
|
|
|
|
- if(this.disabled!== undefined){
|
|
|
|
|
|
+ '$store.state.app.loadingStatus': function (a, b) {
|
|
|
|
+ if (!a) {
|
|
|
|
+ if (this.disabled !== undefined) {
|
|
this.disabled = a
|
|
this.disabled = a
|
|
}
|
|
}
|
|
- if(this.spinning!== undefined){
|
|
|
|
|
|
+ if (this.spinning !== undefined) {
|
|
this.spinning = a
|
|
this.spinning = a
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
},
|
|
- methods:{
|
|
|
|
|
|
+ methods: {
|
|
// 清除组件缓存
|
|
// 清除组件缓存
|
|
- clearCompCache(cache,keys,key){
|
|
|
|
- if (cache[key]&&cache[key].componentInstance){
|
|
|
|
|
|
+ clearCompCache (cache, keys, key) {
|
|
|
|
+ if (cache[key] && cache[key].componentInstance) {
|
|
cache[key].componentInstance.$destroy()
|
|
cache[key].componentInstance.$destroy()
|
|
if (keys.length) {
|
|
if (keys.length) {
|
|
- var index = keys.indexOf(key);
|
|
|
|
- if (index > -1) {
|
|
|
|
- keys.splice(index, 1);
|
|
|
|
- }
|
|
|
|
|
|
+ var index = keys.indexOf(key)
|
|
|
|
+ if (index > -1) {
|
|
|
|
+ keys.splice(index, 1)
|
|
|
|
+ }
|
|
}
|
|
}
|
|
- delete cache[key];
|
|
|
|
|
|
+ delete cache[key]
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
},
|
|
- beforeRouteLeave(to, from, next) {
|
|
|
|
|
|
+ beforeRouteLeave (to, from, next) {
|
|
const newVal = to
|
|
const newVal = to
|
|
const oldVal = from
|
|
const oldVal = from
|
|
// 是否时同一个父级菜单下的页面
|
|
// 是否时同一个父级菜单下的页面
|
|
@@ -120,28 +120,28 @@ const commonMixin = {
|
|
// console.log(hasChildren,oa||ob||oc||oxt)
|
|
// console.log(hasChildren,oa||ob||oc||oxt)
|
|
const key = this.$vnode.key
|
|
const key = this.$vnode.key
|
|
const parentNode = this.$vnode.parent
|
|
const parentNode = this.$vnode.parent
|
|
- const cache = parentNode&&parentNode.componentInstance?parentNode.componentInstance.cache:null
|
|
|
|
- const keys = parentNode&&parentNode.componentInstance?parentNode.componentInstance.keys:null
|
|
|
|
|
|
+ const cache = parentNode && parentNode.componentInstance ? parentNode.componentInstance.cache : null
|
|
|
|
+ const keys = parentNode && parentNode.componentInstance ? parentNode.componentInstance.keys : null
|
|
const closeTabPages = this.$store.state.app.closeTabPages
|
|
const closeTabPages = this.$store.state.app.closeTabPages
|
|
const multiTab = this.$store.state.app.multiTab
|
|
const multiTab = this.$store.state.app.multiTab
|
|
// console.log(closeTabPages,key)
|
|
// console.log(closeTabPages,key)
|
|
// 清空同级路由的组件缓存
|
|
// 清空同级路由的组件缓存
|
|
- if(hasChildren&&(oa||ob||oc||oxt)&&cache&&keys){
|
|
|
|
- this.clearCompCache(cache,keys,key)
|
|
|
|
|
|
+ if (hasChildren && (oa || ob || oc || oxt) && cache && keys) {
|
|
|
|
+ this.clearCompCache(cache, keys, key)
|
|
// 单页签模式
|
|
// 单页签模式
|
|
- if(!multiTab){
|
|
|
|
|
|
+ if (!multiTab) {
|
|
this.$store.state.app.isNewTab = false
|
|
this.$store.state.app.isNewTab = false
|
|
this.$store.state.app.updateList = true
|
|
this.$store.state.app.updateList = true
|
|
}
|
|
}
|
|
}
|
|
}
|
|
// 单页签模式,并且不是同级菜单的清空组件
|
|
// 单页签模式,并且不是同级菜单的清空组件
|
|
- if(!multiTab&&!hasChildren){
|
|
|
|
- this.clearCompCache(cache,keys,key)
|
|
|
|
|
|
+ if (!multiTab && !hasChildren) {
|
|
|
|
+ this.clearCompCache(cache, keys, key)
|
|
}
|
|
}
|
|
// 批量清空组件缓存
|
|
// 批量清空组件缓存
|
|
- if(closeTabPages.length&&cache&&keys){
|
|
|
|
- for(let i=0;i<closeTabPages.length;i++){
|
|
|
|
- this.clearCompCache(cache,keys,closeTabPages[i])
|
|
|
|
|
|
+ if (closeTabPages && closeTabPages.length && cache && keys) {
|
|
|
|
+ for (let i = 0; i < closeTabPages.length; i++) {
|
|
|
|
+ this.clearCompCache(cache, keys, closeTabPages[i])
|
|
}
|
|
}
|
|
this.$store.state.app.closeTabPages = []
|
|
this.$store.state.app.closeTabPages = []
|
|
}
|
|
}
|