Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
VueElementTemplate
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
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
黄瑜
VueElementTemplate
Commits
91cb0ac5
Commit
91cb0ac5
authored
7 years ago
by
Pan
Committed by
花裤衩
7 years ago
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add view tabs
parent
7549eb80
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
39 additions
and
1 deletion
+39
-1
getters.js
src/store/getters.js
+1
-0
app.js
src/store/modules/app.js
+16
-1
Levelbar.vue
src/views/layout/Levelbar.vue
+22
-0
No files found.
src/store/getters.js
View file @
91cb0ac5
const
getters
=
{
const
getters
=
{
sidebar
:
state
=>
state
.
app
.
sidebar
,
sidebar
:
state
=>
state
.
app
.
sidebar
,
visitedViews
:
state
=>
state
.
app
.
visitedViews
,
token
:
state
=>
state
.
user
.
token
,
token
:
state
=>
state
.
user
.
token
,
avatar
:
state
=>
state
.
user
.
avatar
,
avatar
:
state
=>
state
.
user
.
avatar
,
name
:
state
=>
state
.
user
.
name
,
name
:
state
=>
state
.
user
.
name
,
...
...
This diff is collapsed.
Click to expand it.
src/store/modules/app.js
View file @
91cb0ac5
...
@@ -6,7 +6,8 @@ const app = {
...
@@ -6,7 +6,8 @@ const app = {
opened
:
!+
Cookies
.
get
(
'sidebarStatus'
)
opened
:
!+
Cookies
.
get
(
'sidebarStatus'
)
},
},
theme
:
'default'
,
theme
:
'default'
,
livenewsChannels
:
Cookies
.
get
(
'livenewsChannels'
)
||
'[]'
livenewsChannels
:
Cookies
.
get
(
'livenewsChannels'
)
||
'[]'
,
visitedViews
:
[]
},
},
mutations
:
{
mutations
:
{
TOGGLE_SIDEBAR
:
state
=>
{
TOGGLE_SIDEBAR
:
state
=>
{
...
@@ -16,11 +17,25 @@ const app = {
...
@@ -16,11 +17,25 @@ const app = {
Cookies
.
set
(
'sidebarStatus'
,
0
);
Cookies
.
set
(
'sidebarStatus'
,
0
);
}
}
state
.
sidebar
.
opened
=
!
state
.
sidebar
.
opened
;
state
.
sidebar
.
opened
=
!
state
.
sidebar
.
opened
;
},
ADD_VISITED_VIEWS
:
(
state
,
view
)
=>
{
if
(
state
.
visitedViews
.
includes
(
view
))
return
state
.
visitedViews
.
push
(
view
)
},
DEL_VISITED_VIEWS
:
(
state
,
view
)
=>
{
const
index
=
state
.
visitedViews
.
indexOf
(
view
)
state
.
visitedViews
.
splice
(
index
,
1
)
}
}
},
},
actions
:
{
actions
:
{
ToggleSideBar
:
({
commit
})
=>
{
ToggleSideBar
:
({
commit
})
=>
{
commit
(
'TOGGLE_SIDEBAR'
)
commit
(
'TOGGLE_SIDEBAR'
)
},
addVisitedViews
:
({
commit
},
view
)
=>
{
commit
(
'ADD_VISITED_VIEWS'
,
view
)
},
delVisitedViews
:
({
commit
},
view
)
=>
{
commit
(
'DEL_VISITED_VIEWS'
,
view
)
}
}
}
}
};
};
...
...
This diff is collapsed.
Click to expand it.
src/views/layout/Levelbar.vue
View file @
91cb0ac5
...
@@ -4,14 +4,25 @@
...
@@ -4,14 +4,25 @@
<router-link
v-if=
'item.redirect==="noredirect"||index==levelList.length-1'
to=
""
class=
"no-redirect"
>
{{
item
.
name
}}
</router-link>
<router-link
v-if=
'item.redirect==="noredirect"||index==levelList.length-1'
to=
""
class=
"no-redirect"
>
{{
item
.
name
}}
</router-link>
<router-link
v-else
:to=
"item.path"
>
{{
item
.
name
}}
</router-link>
<router-link
v-else
:to=
"item.path"
>
{{
item
.
name
}}
</router-link>
</el-breadcrumb-item>
</el-breadcrumb-item>
<router-link
class=
"view-tabs"
v-for=
"tag in Array.from(visitedViews)"
:to=
"tag.path"
:key=
"tag.path"
>
<el-tag
:closable=
"true"
@
close=
'closeViewTabs(tag,$event)'
>
{{
tag
.
name
}}
</el-tag>
</router-link>
</el-breadcrumb>
</el-breadcrumb>
</
template
>
</
template
>
<
script
>
<
script
>
export
default
{
export
default
{
created
()
{
created
()
{
this
.
getBreadcrumb
()
this
.
getBreadcrumb
()
},
},
computed
:
{
visitedViews
()
{
return
this
.
$store
.
state
.
app
.
visitedViews
.
slice
(
-
6
)
}
},
data
()
{
data
()
{
return
{
return
{
levelList
:
null
levelList
:
null
...
@@ -25,10 +36,18 @@
...
@@ -25,10 +36,18 @@
matched
=
[{
name
:
'首页'
,
path
:
'/'
}].
concat
(
matched
)
matched
=
[{
name
:
'首页'
,
path
:
'/'
}].
concat
(
matched
)
}
}
this
.
levelList
=
matched
;
this
.
levelList
=
matched
;
},
closeViewTabs
(
view
,
$event
)
{
this
.
$store
.
dispatch
(
'delVisitedViews'
,
view
)
$event
.
preventDefault
()
},
addViewTabs
()
{
this
.
$store
.
dispatch
(
'addVisitedViews'
,
this
.
$route
.
matched
[
this
.
$route
.
matched
.
length
-
1
])
}
}
},
},
watch
:
{
watch
:
{
$route
()
{
$route
()
{
this
.
addViewTabs
();
this
.
getBreadcrumb
();
this
.
getBreadcrumb
();
}
}
}
}
...
@@ -46,4 +65,7 @@
...
@@ -46,4 +65,7 @@
cursor
:text
;
cursor
:text
;
}
}
}
}
.view-tabs
{
margin-left
:
10px
;
}
</
style
>
</
style
>
This diff is collapsed.
Click to expand it.
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