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
c927dfb1
Commit
c927dfb1
authored
Aug 22, 2016
by
baiyaaaaa
Committed by
GitHub
Aug 22, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #92 from eleme/feat/fixed-tab
fixed tab bug
parents
07b9e00f
e113f469
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
14 deletions
+11
-14
examples/docs/tabs.md
examples/docs/tabs.md
+5
-6
packages/tabs/src/tabs.vue
packages/tabs/src/tabs.vue
+6
-8
No files found.
examples/docs/tabs.md
View file @
c927dfb1
...
@@ -23,8 +23,8 @@
...
@@ -23,8 +23,8 @@
handleRemove(tab) {
handleRemove(tab) {
console.log(tab);
console.log(tab);
},
},
handleClick(tab) {
handleClick(tab
, event
) {
console.log(tab);
console.log(tab
, event
);
}
}
}
}
}
}
...
@@ -38,7 +38,7 @@
...
@@ -38,7 +38,7 @@
## 基础使用
## 基础使用
<div>
<div>
<el-tabs
:active-name=
"activeName"
>
<el-tabs>
<el-tab-pane
label=
"选项卡一"
>
选项卡一内容
</el-tab-pane>
<el-tab-pane
label=
"选项卡一"
>
选项卡一内容
</el-tab-pane>
<el-tab-pane
label=
"选项卡二"
>
选项卡二内容
</el-tab-pane>
<el-tab-pane
label=
"选项卡二"
>
选项卡二内容
</el-tab-pane>
<el-tab-pane
label=
"选项卡三"
>
选项卡三内容
</el-tab-pane>
<el-tab-pane
label=
"选项卡三"
>
选项卡三内容
</el-tab-pane>
...
@@ -121,10 +121,9 @@
...
@@ -121,10 +121,9 @@
|---------- |-------- |---------- |------------- |-------- |
|---------- |-------- |---------- |------------- |-------- |
| type | 风格类型 | string | card, border-card | |
| type | 风格类型 | string | card, border-card | |
| closable | 真实值 | boolean | true, false | false |
| closable | 真实值 | boolean | true, false | false |
| defaultActiveName | 如果没有设置 activeName, 则使用该值 | string | | 第一个面板 |
| activeName | 当前选中面板的 name | string | | |
| activeName | 当前选中面板的 name | string | | |
|
tab.click | tab 被点击的回调
| string | | |
|
on-click | tab 被点击的钩子
| string | | |
|
tab.remove | tab 被删除的回调
| string | | |
|
on-remove | tab 被删除的钩子
| string | | |
## TAB-PANE API
## TAB-PANE API
| 参数 | 说明 | 类型 | 可选值 | 默认值 |
| 参数 | 说明 | 类型 | 可选值 | 默认值 |
...
...
packages/tabs/src/tabs.vue
View file @
c927dfb1
...
@@ -13,7 +13,6 @@
...
@@ -13,7 +13,6 @@
props
:
{
props
:
{
type
:
String
,
type
:
String
,
tabPosition
:
String
,
tabPosition
:
String
,
defaultActiveName
:
String
,
activeName
:
String
,
activeName
:
String
,
closable
:
false
,
closable
:
false
,
onRemove
:
{
onRemove
:
{
...
@@ -39,9 +38,8 @@
...
@@ -39,9 +38,8 @@
watch
:
{
watch
:
{
activeName
:
{
activeName
:
{
immediate
:
true
,
handler
(
val
)
{
handler
(
val
)
{
this
.
currentName
=
val
||
0
;
this
.
currentName
=
val
||
this
.
$children
[
0
].
key
;
}
}
},
},
...
@@ -70,12 +68,12 @@
...
@@ -70,12 +68,12 @@
}
}
this
.
onRemove
(
tab
.
key
);
this
.
onRemove
(
tab
.
key
);
},
},
handleTabClick
(
tab
)
{
handleTabClick
(
tab
,
event
)
{
this
.
currentName
=
tab
.
key
;
this
.
currentName
=
tab
.
key
;
this
.
onClick
(
tab
.
key
);
this
.
onClick
(
tab
.
key
,
event
);
},
},
calcBarStyle
()
{
calcBarStyle
()
{
if
(
this
.
type
)
return
{};
if
(
this
.
type
||
!
this
.
$refs
.
tabs
)
return
{};
var
style
=
{};
var
style
=
{};
var
offset
=
0
;
var
offset
=
0
;
var
tabWidth
=
0
;
var
tabWidth
=
0
;
...
@@ -100,7 +98,7 @@
...
@@ -100,7 +98,7 @@
mounted
()
{
mounted
()
{
if
(
!
this
.
currentName
)
{
if
(
!
this
.
currentName
)
{
this
.
currentName
=
this
.
defaultActiveName
||
this
.
$children
[
0
].
key
;
this
.
currentName
=
this
.
$children
[
0
].
key
;
}
}
this
.
$children
.
forEach
(
tab
=>
this
.
tabs
.
push
(
tab
));
this
.
$children
.
forEach
(
tab
=>
this
.
tabs
.
push
(
tab
));
this
.
$nextTick
(()
=>
this
.
calcBarStyle
());
this
.
$nextTick
(()
=>
this
.
calcBarStyle
());
...
@@ -117,7 +115,7 @@
...
@@ -117,7 +115,7 @@
:tab=
"tab"
:tab=
"tab"
:closable=
"closable"
:closable=
"closable"
@
remove=
"handleTabRemove"
@
remove=
"handleTabRemove"
@
click.native=
"handleTabClick(tab)"
>
@
click.native=
"handleTabClick(tab
, $event
)"
>
</el-tab>
</el-tab>
<div
<div
class=
"el-tabs__active-bar"
class=
"el-tabs__active-bar"
...
...
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