Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
Element
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
CI / CD Analytics
Repository Analytics
Value Stream Analytics
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
林焕东
Element
Commits
46835e95
Commit
46835e95
authored
Aug 23, 2016
by
SkyAo
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/next' into next
parents
61a34e66
e5e6140d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
21 deletions
+15
-21
examples/docs/tabs.md
examples/docs/tabs.md
+3
-3
packages/tabs/src/tabs.vue
packages/tabs/src/tabs.vue
+11
-17
packages/theme-default/src/tabs.css
packages/theme-default/src/tabs.css
+1
-1
No files found.
examples/docs/tabs.md
View file @
46835e95
...
...
@@ -44,7 +44,7 @@ Tabs 组件提供了选项卡功能,只需要使用`el-tabs`和子元素`el-ta
下例会选中选项卡2,如果不设置
`name`
,将
`active-name`
设为
`2`
,可以达成相同效果。
<div>
<el-tabs>
<el-tabs
:active-name=
"activeName"
>
<el-tab-pane
label=
"选项卡一"
>
选项卡一内容
</el-tab-pane>
<el-tab-pane
name=
"two"
label=
"选项卡二"
>
选项卡二内容
</el-tab-pane>
<el-tab-pane
label=
"选项卡三"
>
选项卡三内容
</el-tab-pane>
...
...
@@ -95,7 +95,7 @@ Tabs 组件提供了选项卡功能,只需要使用`el-tabs`和子元素`el-ta
```
<div>
<el-tabs
type=
"
border-card
"
>
<el-tabs
type=
"
card"
:closable=
"true"
@
tab-remove=
"handleRemove"
@
tab-click=
"handleClick
"
>
<el-tab-pane
label=
"选项卡一"
>
选项卡一内容
</el-tab-pane>
<el-tab-pane
label=
"选项卡二"
>
选项卡二内容
</el-tab-pane>
<el-tab-pane
label=
"选项卡三"
>
选项卡三内容
</el-tab-pane>
...
...
@@ -104,7 +104,7 @@ Tabs 组件提供了选项卡功能,只需要使用`el-tabs`和子元素`el-ta
</div>
```
html
<el-tabs
type=
"
border-card
"
>
<el-tabs
type=
"
card"
:closable=
"true"
@
tab-remove=
"handleRemove"
@
tab-click=
"handleClick
"
>
<el-tab-pane
label=
"选项卡一"
>
选项卡一内容
</el-tab-pane>
<el-tab-pane
label=
"选项卡二"
>
选项卡二内容
</el-tab-pane>
<el-tab-pane
label=
"选项卡三"
>
选项卡三内容
</el-tab-pane>
...
...
packages/tabs/src/tabs.vue
View file @
46835e95
<
script
>
import
ElTab
from
'
./tab
'
;
function
noop
()
{}
module
.
exports
=
{
name
:
'
el-tabs
'
,
...
...
@@ -15,14 +13,6 @@
tabPosition
:
String
,
activeName
:
String
,
closable
:
false
,
onRemove
:
{
type
:
Function
,
default
:
noop
},
onClick
:
{
type
:
Function
,
default
:
noop
},
tabWidth
:
0
},
...
...
@@ -39,7 +29,8 @@
watch
:
{
activeName
:
{
handler
(
val
)
{
this
.
currentName
=
val
||
this
.
$children
[
0
].
key
;
var
fisrtKey
=
this
.
$children
[
0
]
&&
this
.
$children
[
0
].
key
||
'
1
'
;
this
.
currentName
=
val
||
fisrtKey
;
}
},
...
...
@@ -66,13 +57,13 @@
this
.
currentName
=
nextChild
?
nextChild
.
key
:
prevChild
?
prevChild
.
key
:
'
-1
'
;
}
this
.
onRemove
(
tab
.
key
);
this
.
$emit
(
'
tab-remove
'
,
tab
.
key
);
},
handleTabClick
(
tab
,
event
)
{
this
.
currentName
=
tab
.
key
;
this
.
onClick
(
tab
.
key
,
event
);
this
.
$emit
(
'
tab-click
'
,
tab
.
key
,
event
);
},
calcBarStyle
()
{
calcBarStyle
(
firstRendering
)
{
if
(
this
.
type
||
!
this
.
$refs
.
tabs
)
return
{};
var
style
=
{};
var
offset
=
0
;
...
...
@@ -92,16 +83,19 @@
style
.
width
=
tabWidth
+
'
px
'
;
style
.
transform
=
`translateX(
${
offset
}
px)`
;
if
(
!
firstRendering
)
{
style
.
transition
=
'
transform .3s cubic-bezier(.645,.045,.355,1), -webkit-transform .3s cubic-bezier(.645,.045,.355,1)
'
;
}
this
.
barStyle
=
style
;
}
},
mounted
()
{
if
(
!
this
.
currentName
)
{
this
.
currentName
=
this
.
$children
[
0
].
key
;
var
fisrtKey
=
this
.
$children
[
0
]
&&
this
.
$children
[
0
].
key
||
'
1
'
;
this
.
currentName
=
this
.
activeName
||
fisrtKey
;
}
this
.
$children
.
forEach
(
tab
=>
this
.
tabs
.
push
(
tab
));
this
.
$nextTick
(()
=>
this
.
calcBarStyle
());
this
.
$nextTick
(()
=>
this
.
calcBarStyle
(
true
));
}
};
</
script
>
...
...
packages/theme-default/src/tabs.css
View file @
46835e95
...
...
@@ -19,7 +19,7 @@
height
:
3px
;
background-color
:
var
(
--color-primary
);
z-index
:
1
;
transition
:
transform
.3s
cubic-bezier
(
.645
,
.045
,
.355
,
1
);
/*transition: transform .3s cubic-bezier(.645,.045,.355,1);*/
list-style
:
none
;
}
@e
item
{
...
...
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