Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
ant-design-pro-vue
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
tianzhuanghu
ant-design-pro-vue
Commits
a9e5710a
Commit
a9e5710a
authored
Feb 27, 2019
by
kokoroli
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix:MultiTab close methods
parent
bbd917d4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
7 deletions
+28
-7
MultiTab.vue
src/components/MultiTab/MultiTab.vue
+28
-7
No files found.
src/components/MultiTab/MultiTab.vue
View file @
a9e5710a
...
...
@@ -49,8 +49,10 @@ export default {
remove
(
targetKey
)
{
this
.
pages
=
this
.
pages
.
filter
(
page
=>
page
.
fullPath
!==
targetKey
)
this
.
fullPathList
=
this
.
fullPathList
.
filter
(
path
=>
path
!==
targetKey
)
// 跳转到最后一个还存在的标签页
this
.
selectedLastPath
()
// 判断当前标签是否关闭,若关闭则跳转到最后一个还存在的标签页
if
(
!
this
.
fullPathList
.
includes
(
this
.
activeKey
))
{
this
.
selectedLastPath
()
}
},
selectedLastPath
()
{
this
.
activeKey
=
this
.
fullPathList
[
this
.
fullPathList
.
length
-
1
]
...
...
@@ -65,15 +67,29 @@ export default {
// TODO
console
.
log
(
'close left'
,
e
)
const
index
=
this
.
fullPathList
.
indexOf
(
e
)
if
(
index
>
-
1
)
{
this
.
fullPathList
.
splice
(
index
,
-
1
)
if
(
index
>
0
)
{
this
.
remove
(
this
.
fullPathList
[
index
-
1
])
}
else
{
this
.
$message
.
info
(
'左侧没有标签'
)
}
},
closeRight
(
e
)
{
console
.
log
(
'close right'
,
e
)
const
index
=
this
.
fullPathList
.
indexOf
(
e
)
if
(
index
<
(
this
.
fullPathList
.
length
-
1
))
{
this
.
remove
(
this
.
fullPathList
[
index
+
1
])
}
else
{
this
.
$message
.
info
(
'右侧没有标签'
)
}
},
closeAll
(
e
)
{
console
.
log
(
'close all'
,
e
)
const
currentIndex
=
this
.
fullPathList
.
indexOf
(
e
)
this
.
fullPathList
.
forEach
((
item
,
index
)
=>
{
if
(
index
!==
currentIndex
)
{
this
.
remove
(
item
)
}
})
},
closeMenuClick
({
key
,
item
,
domEvent
})
{
console
.
log
(
'key'
,
key
)
...
...
@@ -132,7 +148,13 @@ export default {
render
()
{
const
{
onEdit
,
$data
:
{
pages
}
}
=
this
const
panes
=
pages
.
map
(
page
=>
{
return
(
<
a
-
tab
-
pane
style
=
{{
height
:
0
}}
tab
=
{
this
.
renderTabPane
(
page
.
meta
.
title
,
page
.
fullPath
)}
key
=
{
page
.
fullPath
}
closable
=
{
pages
.
length
>
1
}
><
/a-tab-pane>
)
return
(
<
a
-
tab
-
pane
style
=
{{
height
:
0
}}
tab
=
{
this
.
renderTabPane
(
page
.
meta
.
title
,
page
.
fullPath
)}
key
=
{
page
.
fullPath
}
closable
=
{
pages
.
length
>
1
}
>
<
/a-tab-pane>
)
})
return
(
...
...
@@ -149,4 +171,4 @@ export default {
)
}
}
</
script
>
\ No newline at end of file
</
script
>
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