Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
V
vue-gjjs
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
zhouqian
vue-gjjs
Commits
7f2c205e
Commit
7f2c205e
authored
Oct 26, 2022
by
潘际乾
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
电证整合,解决keep-alive缓存iframe刷新的问题
parent
c6b99326
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
75 additions
and
12 deletions
+75
-12
SubMenu.vue
src/components/SubMenu.vue
+0
-9
BusRouter.js
src/views/Business/BusRouter.js
+2
-2
index.vue
src/views/Business/index.vue
+72
-1
menus.js
src/views/Layout/dz/menus.js
+1
-0
No files found.
src/components/SubMenu.vue
View file @
7f2c205e
...
...
@@ -17,7 +17,6 @@
</
template
>
<SubMenu
:subMenuList=
"item.children"
:openFlgArr=
"openFlgArr"
/>
</el-submenu>
<!-- <el-menu-item v-else :key="item.path" :index="item.isDz ? null : item.path" @click="gotoView(item)"> -->
<el-menu-item
v-else
:key=
"item.path"
:index=
"item.path"
:route=
"item.isDz ? { name: 'DzSys', params: { path: getDynamicPath(item.path), title: item.name}} : { path: item.path }"
>
<
template
slot=
"title"
>
...
...
@@ -40,14 +39,6 @@ export default {
getOpenFlag
(
index
)
{
return
this
.
openFlgArr
.
includes
(
index
);
},
// gotoView(item) {
// if (!item.isDz) {
// return
// }
// const path = item.path
// const p = path.split("/")
// this.$router.push({name: 'DzSys', params: {path: p[p.length - 1], title: item.name}})
// }
getDynamicPath
(
path
)
{
const
p
=
path
.
split
(
"/"
)
return
p
[
p
.
length
-
1
]
...
...
src/views/Business/BusRouter.js
View file @
7f2c205e
...
...
@@ -214,7 +214,6 @@ import Dbiusr from "./Dbiusr"
import
Dbibch
from
"./Dbibch"
import
Infact
from
"./Infact"
import
DzSys
from
"~/views/Layout/dz/DzSys.vue"
;
/**
* 带有name的才会被添加进顶部的标签页里
...
...
@@ -443,6 +442,6 @@ const BusRouter = [
{
path
:
'Ordrel'
,
component
:
Ordrel
,
name
:
'Ordrel'
,
meta
:
{
title
:
'Ordrel'
}
},
{
path
:
'Infact'
,
component
:
Infact
,
name
:
'Infact'
,
meta
:
{
title
:
'账户'
}
},
{
path
:
'dzsys/:path'
,
component
:
DzSys
,
name
:
'DzSys'
,
meta
:
{
title
:
(
tag
)
=>
{
return
'电证 - '
+
tag
.
params
.
title
}
}
},
{
path
:
'dzsys/:path'
,
name
:
'DzSys'
,
meta
:
{
title
:
(
tag
)
=>
{
return
'电证 - '
+
tag
.
params
.
title
}
}
},
]
export
default
BusRouter
\ No newline at end of file
src/views/Business/index.vue
View file @
7f2c205e
...
...
@@ -5,10 +5,22 @@
<router-view
:key=
"key"
/>
</keep-alive>
</transition>
<component
v-for=
"item in hasOpenComponentsArr"
:key=
"item.name"
:is=
"item.name"
v-show=
"$route.path === item.path"
></component>
</section>
</
template
>
<
script
>
import
Vue
from
"vue"
;
import
DzSys
from
"~/views/Layout/dz/DzSys.vue"
;
import
{
getDzSysMenu
}
from
"~/views/Layout/dz/menus.js"
;
export
default
{
name
:
"Business"
,
watch
:
{
...
...
@@ -18,19 +30,78 @@ export default {
}
else
{
this
.
$store
.
commit
(
"setMode"
,
"normal"
);
}
this
.
componentsArr
.
forEach
(
comp
=>
{
if
(
!
this
.
visitedViews
.
find
(
view
=>
view
.
path
===
comp
.
path
))
{
comp
.
hasOpen
=
false
}
})
// 判断当前路由是否iframe页
this
.
isOpenIframePage
();
},
},
created
:
()
=>
{
created
()
{
console
.
log
(
"进入业务交易界面"
);
// 设置iframe页的数组对象
const
componentsArr
=
[]
const
dzSysMenu
=
getDzSysMenu
()
this
.
getComponentsArr
(
componentsArr
,
dzSysMenu
?
dzSysMenu
.
children
:
[]);
componentsArr
.
forEach
((
item
)
=>
{
Vue
.
component
(
item
.
name
,
DzSys
);
});
this
.
componentsArr
=
componentsArr
;
// 判断当前路由是否iframe页
this
.
isOpenIframePage
();
},
computed
:
{
cachedViews
()
{
return
this
.
$store
.
state
.
TagsView
.
cachedViews
;
},
visitedViews
()
{
return
this
.
$store
.
state
.
TagsView
.
visitedViews
;
},
key
()
{
return
this
.
$route
.
path
;
},
// 实现懒加载,只渲染已经打开过(hasOpen:true)的iframe页
hasOpenComponentsArr
()
{
return
this
.
componentsArr
.
filter
(
item
=>
item
.
hasOpen
);
}
},
data
()
{
return
{
componentsArr
:
[]
}
},
methods
:
{
// 根据当前路由设置hasOpen
isOpenIframePage
()
{
const
target
=
this
.
componentsArr
.
find
(
item
=>
{
return
item
.
path
===
this
.
$route
.
path
});
if
(
target
&&
!
target
.
hasOpen
)
{
target
.
hasOpen
=
true
;
}
},
// 遍历路由的所有页面,把含有iframeComponent标识的收集起来
getComponentsArr
(
arr
,
menus
)
{
for
(
let
i
=
0
;
i
<
menus
.
length
;
i
++
)
{
const
menu
=
menus
[
i
];
if
(
menu
.
children
.
length
)
{
const
tempArr
=
[]
this
.
getComponentsArr
(
tempArr
,
menu
.
children
)
arr
.
push
(...
tempArr
)
}
else
{
arr
.
push
({
name
:
menu
.
value
,
path
:
menu
.
path
,
hasOpen
:
false
,
// 是否打开过,默认false
})
}
}
}
}
};
</
script
>
...
...
src/views/Layout/dz/menus.js
View file @
7f2c205e
...
...
@@ -14,6 +14,7 @@ const generateMenuTree = (menus) => {
}
else
{
arr
.
push
({
name
:
menu
.
label
,
value
:
'dzsys-'
+
menu
.
value
,
path
:
'/business/dzsys/'
+
menu
.
value
,
isDz
:
true
,
icon
:
"el-icon-document"
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment