fix:修复点击关闭按钮报错问题
This commit is contained in:
parent
f43cb2aeff
commit
fd8b630d65
|
|
@ -9,7 +9,7 @@ export default {
|
|||
name: 'UniEleDoc',
|
||||
data() {
|
||||
return {
|
||||
url: 'https://gitee.com/nickzhan/uni-element-ui-admin/blob/master/README.md'
|
||||
url: 'https://github.com/zouzhibin/vue-admin-perfect'
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@ export default {
|
|||
mounted() {
|
||||
// 关闭标签触发
|
||||
Global.$on("removeCache", (name, view) => {
|
||||
|
||||
this.removeCache(name, view);
|
||||
});
|
||||
},
|
||||
|
|
@ -52,6 +53,7 @@ export default {
|
|||
},
|
||||
// 移除keep-alive缓存
|
||||
removeCache(name, view = {}) {
|
||||
|
||||
let vnode = this.getVnode();
|
||||
if (!vnode) return false;
|
||||
let componentInstance = vnode.parent.componentInstance;
|
||||
|
|
@ -64,6 +66,9 @@ export default {
|
|||
},
|
||||
// 移除其他
|
||||
closeOthersTags({ componentInstance, thisKey }) {
|
||||
if(!componentInstance.cache){
|
||||
return
|
||||
}
|
||||
Object.keys(componentInstance.cache).forEach((key, index) => {
|
||||
if (key != thisKey) {
|
||||
// 销毁实例(这里存在多个key指向一个缓存的情况可能前面一个已经清除掉了所有要加判断)
|
||||
|
|
@ -79,6 +84,9 @@ export default {
|
|||
},
|
||||
// 移除所有缓存
|
||||
closeAllTags({ componentInstance }) {
|
||||
if(!componentInstance.cache){
|
||||
return
|
||||
}
|
||||
// 销毁实例
|
||||
Object.keys(componentInstance.cache).forEach((key) => {
|
||||
if (componentInstance.cache[key]) {
|
||||
|
|
@ -93,21 +101,27 @@ export default {
|
|||
// 移除单个缓存
|
||||
closeSelectedTag({ componentInstance, regKey }) {
|
||||
let reg = new RegExp(`^${regKey}`);
|
||||
Object.keys(componentInstance.cache).forEach((key, i) => {
|
||||
if (reg.test(key)) {
|
||||
// 销毁实例
|
||||
if (componentInstance.cache[key]) {
|
||||
componentInstance.cache[key].componentInstance.$destroy();
|
||||
if(componentInstance.cache){
|
||||
Object.keys(componentInstance.cache).forEach((key, i) => {
|
||||
if (reg.test(key)) {
|
||||
// 销毁实例
|
||||
if (componentInstance.cache[key]) {
|
||||
componentInstance.cache[key].componentInstance.$destroy();
|
||||
}
|
||||
// 删除缓存
|
||||
delete componentInstance.cache[key];
|
||||
// 移除key中对应的key
|
||||
componentInstance.keys.splice(i, 1);
|
||||
}
|
||||
// 删除缓存
|
||||
delete componentInstance.cache[key];
|
||||
// 移除key中对应的key
|
||||
componentInstance.keys.splice(i, 1);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
},
|
||||
// 刷新单个缓存
|
||||
refreshSelectedTag({ componentInstance, thisKey }) {
|
||||
if(!componentInstance.cache){
|
||||
return
|
||||
}
|
||||
Object.keys(componentInstance.cache).forEach((key, index) => {
|
||||
if (null != thisKey && key.replace("/redirect", "") == thisKey) {
|
||||
// 1 销毁实例(这里存在多个key指向一个缓存的情况可能前面一个已经清除掉了所有要加判断)
|
||||
|
|
|
|||
|
|
@ -94,7 +94,6 @@ var convertToLineData = function(data, gps) {
|
|||
for (var i = 0; i < data.length; i++) {
|
||||
var dataItem = data[i];
|
||||
var toCoord = geoCoordMap[dataItem.name];
|
||||
debugger;
|
||||
var fromCoord = gps; //郑州
|
||||
// var toCoord = geoGps[Math.random()*3];
|
||||
if (fromCoord && toCoord) {
|
||||
|
|
|
|||
|
|
@ -14,8 +14,8 @@
|
|||
<div v-for="(item,index) in links" :key="index">
|
||||
<span class="text" @click="goto(item.url)">{{ item.title }}</span>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="flink">
|
||||
<span class="flink-title">友情链接</span>
|
||||
<div v-for="(item,index) in flinks" :key="index">
|
||||
|
|
@ -30,14 +30,9 @@ export default {
|
|||
data() {
|
||||
return {
|
||||
links: [
|
||||
{title: '源码地址', url: 'https://gitee.com/nickzhan/uni-element-ui-admin'},
|
||||
{title: '文档地址', url: 'https://gitee.com/nickzhan/uni-element-ui-admin/blob/master/README.md'},
|
||||
{title: 'DCloud插件市场地址', url: 'https://ext.dcloud.net.cn/plugin?id=5953'},
|
||||
{title: '作者的博客园', url: 'https://www.cnblogs.com/mihuk'},
|
||||
{title: '源码地址', url: 'https://github.com/zouzhibin/vue-admin-perfect'},
|
||||
{title: '文档地址', url: 'https://github.com/zouzhibin/vue-admin-perfect'},
|
||||
],
|
||||
flinks: [
|
||||
{title: 'ElementUI-V2官网', url: 'https://element.eleme.cn/#/zh-CN'}
|
||||
]
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
|
|
|||
Binary file not shown.
Loading…
Reference in New Issue