Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
micro-customization-system
/
micro-portal
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 16845518
authored
May 29, 2021
by
胡悦
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
修改样式
1 parent
1fb7def1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
131 additions
and
123 deletions
src/components/DesktopRightSider/DesktopRightSider.vue
src/components/DesktopRightSider/DesktopRightSider.vue
View file @
1684551
<
template
>
<el-main
class=
"glsx-right-side"
:style=
"
{ margin: '24px 16px', padding: '24px', background: '#fff', minHeight: '280px' }"
>
<el-breadcrumb>
<el-breadcrumb-item
class=
"breadcrumb-item"
:class=
"
{active: item.active, pointer: item.path}"
v-for="(item, index) in breadCrumbList"
:key="index"
@click="routerGo(item, item.path || '/noData')">
{{
item
.
name
}}
</el-breadcrumb-item>
</el-breadcrumb>
<div
v-show=
"showEmpty"
>
<el-empty
description=
"暂无数据"
:image-size=
"imgSize"
></el-empty>
</div>
<div
v-show=
"!showEmpty"
id=
"sub-system-frame"
ref=
"elmSubMicro"
></div>
</el-main>
<el-main
class=
"glsx-right-side"
:style=
"
{ margin: '24px 16px', padding: '24px', background: '#fff', minHeight: '280px' }"
>
<el-breadcrumb>
<el-breadcrumb-item
class=
"breadcrumb-item"
:class=
"
{active: item.active, pointer: item.path}"
v-for="(item, index) in breadCrumbList"
:key="index"
@click="routerGo(item, item.path || '/noData')"
>
{{
item
.
name
}}
</el-breadcrumb-item>
</el-breadcrumb>
<div
v-show=
"showEmpty"
>
<el-empty
description=
"暂无数据"
:image-size=
"imgSize"
></el-empty>
</div>
<div
v-show=
"!showEmpty"
id=
"sub-system-frame"
ref=
"elmSubMicro"
></div>
</el-main>
</
template
>
<
script
>
...
...
@@ -24,142 +33,141 @@ import { useStore } from 'vuex';
import
{
reactive
,
toRefs
,
computed
,
onMounted
,
ref
}
from
'vue'
;
export
default
{
name
:
'DesktopRightSider'
,
setup
(
props
,
context
)
{
const
elmSubMicro
=
ref
(
null
);
const
state
=
reactive
({
imgSize
:
100
,
el_sub_innerH
:
''
name
:
'DesktopRightSider'
,
setup
(
props
,
context
)
{
const
elmSubMicro
=
ref
(
null
);
const
state
=
reactive
({
imgSize
:
100
,
el_sub_innerH
:
''
});
const
store
=
useStore
();
onMounted
(()
=>
{
state
.
el_sub_innerH
=
elmSubMicro
.
_value
.
innerHTML
;
// 监听子系统挂载的元素内容变化
const
subMircroEle
=
document
.
getElementById
(
'sub-system-frame'
);
subMircroEle
.
addEventListener
(
'DOMNodeInserted'
,
function
(
e
)
{
const
target
=
e
.
currentTarget
,
tarInner
=
target
.
innerHTML
;
if
(
!
state
.
el_sub_innerH
!==
!
tarInner
)
{
state
.
el_sub_innerH
=
target
.
innerHTML
;
}
})
})
const
showEmpty
=
computed
(()
=>
{
return
store
.
getters
.
commonData
.
showEmpty
||
!
state
.
el_sub_innerH
;
})
const
breadCrumbList
=
computed
(()
=>
{
const
curBreadCrumb
=
store
.
getters
.
curBreadCrumb
,
curParent
=
curBreadCrumb
[
'parent'
],
curChildren
=
curBreadCrumb
[
'children'
];
let
breadCrumbList
=
[];
if
(
curParent
)
{
breadCrumbList
.
push
({
name
:
curChildren
.
menuName
?
curParent
.
menuName
:
curParent
.
menuName
});
}
if
(
curChildren
)
{
const
nextChildren
=
curChildren
.
children
;
breadCrumbList
.
push
({
name
:
nextChildren
?
curChildren
.
menuName
:
curChildren
.
menuName
,
path
:
curChildren
.
path
,
active
:
nextChildren
?
false
:
true
});
const
store
=
useStore
();
onMounted
(()
=>
{
state
.
el_sub_innerH
=
elmSubMicro
.
_value
.
innerHTML
;
// 监听子系统挂载的元素内容变化
const
subMircroEle
=
document
.
getElementById
(
'sub-system-frame'
);
subMircroEle
.
addEventListener
(
'DOMNodeInserted'
,
function
(
e
)
{
const
target
=
e
.
currentTarget
,
tarInner
=
target
.
innerHTML
;
if
(
!
state
.
el_sub_innerH
!==
!
tarInner
)
{
state
.
el_sub_innerH
=
target
.
innerHTML
;
}
})
})
const
showEmpty
=
computed
(()
=>
{
return
store
.
getters
.
commonData
.
showEmpty
||
!
state
.
el_sub_innerH
;
})
const
breadCrumbList
=
computed
(()
=>
{
const
curBreadCrumb
=
store
.
getters
.
curBreadCrumb
,
curParent
=
curBreadCrumb
[
'parent'
],
curChildren
=
curBreadCrumb
[
'children'
];
let
breadCrumbList
=
[];
if
(
curParent
)
{
breadCrumbList
.
push
({
name
:
curChildren
.
menuName
?
curParent
.
menuName
:
curParent
.
menuName
});
}
if
(
curChildren
)
{
const
nextChildren
=
curChildren
.
children
;
breadCrumbList
.
push
({
name
:
nextChildren
?
curChildren
.
menuName
:
curChildren
.
menuName
,
path
:
curChildren
.
path
,
active
:
nextChildren
?
false
:
true
});
if
(
nextChildren
)
{
breadCrumbList
.
push
({
name
:
nextChildren
.
menuName
,
path
:
nextChildren
.
path
,
active
:
nextChildren
.
active
});
}
}
return
breadCrumbList
;
})
const
routerGo
=
(
item
,
path
)
=>
{
let
saveBreadCrumb
=
{};
const
thisName
=
item
.
name
.
replace
(
' / '
,
''
);
const
curBreadCrumb
=
store
.
getters
.
curBreadCrumb
,
curParent
=
curBreadCrumb
[
'parent'
],
curChildren
=
curBreadCrumb
[
'children'
];
if
(
thisName
===
curParent
.
menuName
)
{
saveBreadCrumb
.
parent
=
curParent
;
saveBreadCrumb
.
children
=
{};
return
false
;
}
if
(
curChildren
)
{
const
nextChildren
=
curChildren
.
children
;
if
(
thisName
===
curChildren
.
menuName
)
{
saveBreadCrumb
.
parent
=
curParent
;
if
(
nextChildren
)
{
delete
curChildren
.
children
;
}
saveBreadCrumb
.
children
=
curChildren
;
}
else
{
if
(
thisName
===
nextChildren
.
menuName
)
{
saveBreadCrumb
=
curBreadCrumb
;
}
}
}
store
.
dispatch
(
'menu/setBreadCrumb'
,
saveBreadCrumb
);
history
.
pushState
(
null
,
path
,
path
);
if
(
nextChildren
)
{
breadCrumbList
.
push
({
name
:
nextChildren
.
menuName
,
path
:
nextChildren
.
path
,
active
:
nextChildren
.
active
});
}
return
{
...
toRefs
(
state
),
breadCrumbList
,
elmSubMicro
,
showEmpty
,
routerGo
}
return
breadCrumbList
;
})
const
routerGo
=
(
item
,
path
)
=>
{
let
saveBreadCrumb
=
{};
const
thisName
=
item
.
name
.
replace
(
' / '
,
''
);
const
curBreadCrumb
=
store
.
getters
.
curBreadCrumb
,
curParent
=
curBreadCrumb
[
'parent'
],
curChildren
=
curBreadCrumb
[
'children'
];
if
(
thisName
===
curParent
.
menuName
)
{
saveBreadCrumb
.
parent
=
curParent
;
saveBreadCrumb
.
children
=
{};
return
false
;
}
if
(
curChildren
)
{
const
nextChildren
=
curChildren
.
children
;
if
(
thisName
===
curChildren
.
menuName
)
{
saveBreadCrumb
.
parent
=
curParent
;
if
(
nextChildren
)
{
delete
curChildren
.
children
;
}
saveBreadCrumb
.
children
=
curChildren
;
}
else
{
if
(
thisName
===
nextChildren
.
menuName
)
{
saveBreadCrumb
=
curBreadCrumb
;
}
}
}
store
.
dispatch
(
'menu/setBreadCrumb'
,
saveBreadCrumb
);
history
.
pushState
(
null
,
path
,
path
);
}
return
{
...
toRefs
(
state
),
breadCrumbList
,
elmSubMicro
,
showEmpty
,
routerGo
}
}
}
</
script
>
<
style
scoped
>
.glsx-right-side
>>>
.breadcrumb-item
span
{
color
:
rgba
(
0
,
0
,
0
,
.45
);
color
:
rgba
(
0
,
0
,
0
,
0
.45
);
}
.glsx-right-side
>>>
.breadcrumb-item.active
span
{
color
:
#2196f3
;
color
:
#2196f3
;
}
</
style
>
<
style
lang=
"less"
scoped
>
@import
'styles/variables.less'
;
@import
"styles/variables.less"
;
.glsx-right-side
{
position
:
relative
;
position
:
relative
;
}
.el-breadcrumb
{
margin-bottom
:
20px
;
margin-bottom
:
20px
;
}
.empty-text
{
text-align
:
center
;
text-align
:
center
;
}
.breadcrumb-item
{
cursor
:
context-menu
;
cursor
:
context-menu
;
.
pointer
:
hover
{
color
:
@
defaultTextColor
;
}
.
pointer
:
hover
{
color
:
@
defaultTextColor
;
}
}
#sub-system-frame
{
min-width
:
1190px
;
//
min-width
:
1190px
;
min-width
:
calc
(
100%
-
400px
);
}
.pointer
{
//
cursor
:
pointer
;
//
cursor
:
pointer
;
}
.active
{
color
:
@
defaultTextColor
;
color
:
@
defaultTextColor
;
}
</
style
>
\ No newline at end of file
Write
Preview
Markdown
is supported
Attach a file
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 post a comment