Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gs1
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
吴迪
gs1
Commits
24ace0b6
Commit
24ace0b6
authored
Oct 03, 2021
by
Tang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 面包屑使用vuex
parent
450edfe0
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
88 additions
and
15 deletions
+88
-15
HeaderDropdown.vue
src/components/layout/header/HeaderDropdown.vue
+2
-2
index.vue
src/components/layout/header/index.vue
+5
-2
index.vue
src/views/Business/index.vue
+8
-2
index.vue
src/views/Search/index.vue
+14
-1
breadcrumb.vue
src/views/comps/breadcrumb.vue
+29
-7
store.js
src/vuex/store.js
+3
-1
index.js
src/vuex/system/index.js
+8
-0
mutations.js
src/vuex/system/mutations.js
+13
-0
state.js
src/vuex/system/state.js
+6
-0
No files found.
src/components/layout/header/HeaderDropdown.vue
View file @
24ace0b6
...
@@ -65,7 +65,7 @@ export default {
...
@@ -65,7 +65,7 @@ export default {
return
(
<
div
class
=
"gs-dropdown-rect"
>
return
(
<
div
class
=
"gs-dropdown-rect"
>
<
div
class
=
"rect-title"
<
div
class
=
"rect-title"
vOn
:
click_stop_prevent
=
{()
=>
{
vOn
:
click_stop_prevent
=
{()
=>
{
this
.
$emit
(
'itemClick'
,
{...
nav
,
parent
:
[
''
]
})
this
.
$emit
(
'itemClick'
,
{...
nav
})
}}
}}
>
>
<
span
class
=
"pointer"
>
{
nav
.
nameInHeaderNav
?
nav
.
nameInHeaderNav
:
nav
.
name
}
<
/span
>
<
span
class
=
"pointer"
>
{
nav
.
nameInHeaderNav
?
nav
.
nameInHeaderNav
:
nav
.
name
}
<
/span
>
...
@@ -83,7 +83,7 @@ export default {
...
@@ -83,7 +83,7 @@ export default {
{
items
.
map
(
item
=>
{
{
items
.
map
(
item
=>
{
return
(
<
div
class
=
"gs-dropdown-item"
>
return
(
<
div
class
=
"gs-dropdown-item"
>
<
span
vOn
:
click_stop_prevent
=
{()
=>
{
<
span
vOn
:
click_stop_prevent
=
{()
=>
{
this
.
$emit
(
'itemClick'
,
item
)
this
.
$emit
(
'itemClick'
,
{...
item
}
)
}}
}}
class
=
"pointer gs-hover"
class
=
"pointer gs-hover"
>
{
item
.
name
}
>
{
item
.
name
}
...
...
src/components/layout/header/index.vue
View file @
24ace0b6
...
@@ -28,7 +28,7 @@
...
@@ -28,7 +28,7 @@
aria-expanded="false">
{{
nav
.
name
}}
</a>
aria-expanded="false">
{{
nav
.
name
}}
</a>
<!-- Dropdown Menu -->
<!-- Dropdown Menu -->
<HeaderDropdown
:nav=
"nav"
/>
<HeaderDropdown
:nav=
"nav"
@
itemClick=
"handleItemClick"
/>
<!-- End Dropdown Menu -->
<!-- End Dropdown Menu -->
</li>
</li>
<!-- Nav items End-->
<!-- Nav items End-->
...
@@ -63,7 +63,10 @@ export default {
...
@@ -63,7 +63,10 @@ export default {
methods
:
{
methods
:
{
handleNavClick
(
nav
)
{
handleNavClick
(
nav
)
{
this
.
currentNav
=
nav
.
id
;
this
.
currentNav
=
nav
.
id
;
}
},
handleItemClick
(
item
){
console
.
log
(
item
);
},
},
},
};
};
</
script
>
</
script
>
...
...
src/views/Business/index.vue
View file @
24ace0b6
<
template
>
<
template
>
<div
class=
"org container"
>
<div
class=
"org container"
>
<breadcrumb/>
<breadcrumb
:value=
"bread"
/>
<div
class=
"row"
>
<div
class=
"row"
>
<div
class=
"col-lg-3"
>
<div
class=
"col-lg-3"
>
<left2/>
<left2/>
...
@@ -26,7 +26,13 @@ export default {
...
@@ -26,7 +26,13 @@ export default {
zxcxgj
,
zxcxgj
,
},
},
data
()
{
data
()
{
return
{};
return
{
bread
:
[
{
name
:
'首页'
,
path
:
'/home'
},
{
name
:
'机构概况'
,
path
:
'#'
},
{
name
:
'地方编码分支机构'
,
path
:
'/Business'
},
]
};
},
},
created
()
{
created
()
{
console
.
log
(
this
.
$route
,
"this.$route"
);
console
.
log
(
this
.
$route
,
"this.$route"
);
...
...
src/views/Search/index.vue
View file @
24ace0b6
<
template
>
<
template
>
<div></div>
<div
class=
"container"
>
<breadcrumb
:value=
"bread"
/>
<div
class=
"row"
>
<div
class=
"col-lg-3"
>
<left2/>
</div>
<div
class=
"col-lg-9"
>
<router-view
class=
"marginTopLg20"
></router-view>
</div>
</div>
<div
class=
"marginTop20"
>
<zxcxgj/>
</div>
</div>
</
template
>
</
template
>
<
script
>
<
script
>
...
...
src/views/comps/breadcrumb.vue
View file @
24ace0b6
<
template
>
<
template
>
<nav
style=
"--bs-breadcrumb-divider: '>'"
aria-label=
"breadcrumb"
>
<nav
style=
"--bs-breadcrumb-divider: '>'"
aria-label=
"breadcrumb"
>
<ol
class=
"breadcrumb"
>
<ol
class=
"breadcrumb"
>
<li
class=
"breadcrumb-item"
><a
href=
"#"
>
首页
</a></li>
<template
v-for=
"item in bread"
>
<li
class=
"breadcrumb-item"
><a
href=
"#"
>
机构概况
</a></li>
<li
class=
"breadcrumb-item"
v-if=
"!item.active"
:key=
"item.path"
>
<li
class=
"breadcrumb-item active"
aria-current=
"page"
>
地方编码分支机构
</li>
<a
:href=
"item.path"
>
{{
item
.
name
}}
</a>
</li>
<li
class=
"breadcrumb-item active"
v-else
:key=
"item.path"
aria-current=
"page"
>
{{
item
.
name
}}
</li>
</
template
>
</ol>
</ol>
</nav>
</nav>
</template>
</template>
<
script
>
import
{
mapState
}
from
'vuex'
export
default
{
computed
:
{
...
mapState
(
'system'
,[
'breadcrumb'
]),
bread
()
{
const
bread
=
[...
this
.
breadcrumb
];
bread
[
bread
.
length
-
1
].
active
=
true
;
return
bread
},
}
}
</
script
>
<
style
lang=
"scss"
>
<
style
lang=
"scss"
>
.breadcrumb
{
.breadcrumb
{
margin-bottom
:
20px
;
margin-bottom
:
20px
;
a{
&-item
{
font-size
:
12px
;
}
a
{
color
:
#00799E
;
color
:
#00799E
;
text-decoration
:
none
;
text-decoration
:
none
;
}
}
}
}
</
style
>
</
style
>
src/vuex/store.js
View file @
24ace0b6
...
@@ -2,11 +2,13 @@ import Vue from 'vue'
...
@@ -2,11 +2,13 @@ import Vue from 'vue'
import
Vuex
from
'vuex'
import
Vuex
from
'vuex'
import
user
from
"./user/index.js"
import
user
from
"./user/index.js"
import
system
from
"./system/index.js"
Vue
.
use
(
Vuex
)
Vue
.
use
(
Vuex
)
export
default
new
Vuex
.
Store
({
export
default
new
Vuex
.
Store
({
modules
:
{
modules
:
{
user
:
user
,
user
,
system
}
}
})
})
src/vuex/system/index.js
0 → 100644
View file @
24ace0b6
import
state
from
"./state.js"
import
mutations
from
"./mutations.js"
export
default
{
namespaced
:
true
,
state
,
mutations
,
}
src/vuex/system/mutations.js
0 → 100644
View file @
24ace0b6
const
mutations
=
{
// 设置面包屑导航
SET_BREADCRUMB
(
state
,
value
)
{
state
.
breadcrumb
=
value
||
[]
},
// 设置子页面导航
SET_SUB_NAV
(
state
,
value
)
{
state
.
subNav
=
value
||
[]
},
}
export
default
mutations
src/vuex/system/state.js
0 → 100644
View file @
24ace0b6
const
state
=
{
breadcrumb
:
[],
subNav
:
[],
}
export
default
state
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