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
3d125796
Commit
3d125796
authored
Dec 08, 2016
by
baiyaaaaa
Committed by
杨奕
Dec 08, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
support tab disabled
parent
658383ec
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
41 additions
and
2 deletions
+41
-2
examples/docs/en-US/tabs.md
examples/docs/en-US/tabs.md
+1
-0
examples/docs/zh-CN/tabs.md
examples/docs/zh-CN/tabs.md
+1
-0
packages/tabs/src/tab-pane.vue
packages/tabs/src/tab-pane.vue
+2
-1
packages/tabs/src/tabs.vue
packages/tabs/src/tabs.vue
+10
-1
packages/theme-default/src/tabs.css
packages/theme-default/src/tabs.css
+5
-0
test/unit/specs/tabs.spec.js
test/unit/specs/tabs.spec.js
+22
-0
No files found.
examples/docs/en-US/tabs.md
View file @
3d125796
...
...
@@ -143,4 +143,5 @@ Border card tabs.
|---------- |-------- |---------- |------------- |-------- |
| label | title of the tab | string | — | — |
| label-content | render function for tab title | Function(h) | - | - |
| disabled | whether Tab is disabled | boolean | - | false |
| name | identifier corresponding to the activeName of Tabs, representing the alias of the tab-pane | string | — | ordinal number of the tab-pane in the sequence, i.e. the first tab-pane is '1' |
examples/docs/zh-CN/tabs.md
View file @
3d125796
...
...
@@ -138,4 +138,5 @@
|---------- |-------- |---------- |------------- |-------- |
| label | 选项卡标题 | string | — | — |
| label-content | 选项卡的标题的渲染 Function | Function(h) | - | - |
| disabled | 是否禁用 | boolean | - | false |
| name | 与选项卡 activeName 对应的标识符,表示选项卡别名 | string | — | 该选项卡在选项卡列表中的顺序值,如第一个选项卡则为'1' |
packages/tabs/src/tab-pane.vue
View file @
3d125796
...
...
@@ -6,7 +6,8 @@
label
:
String
,
labelContent
:
Function
,
name
:
String
,
closable
:
Boolean
closable
:
Boolean
,
disabled
:
Boolean
},
data
()
{
...
...
packages/tabs/src/tabs.vue
View file @
3d125796
...
...
@@ -39,12 +39,21 @@
let
nextChild
=
tabs
[
index
];
let
prevChild
=
tabs
[
index
-
1
];
this
.
currentName
=
nextChild
?
nextChild
.
index
:
prevChild
?
prevChild
.
index
:
'
-1
'
;
while
(
prevChild
&&
prevChild
.
disabled
)
{
prevChild
=
tabs
[
tabs
.
indexOf
(
prevChild
)
-
1
];
}
this
.
currentName
=
nextChild
?
nextChild
.
index
:
prevChild
?
prevChild
.
index
:
'
-1
'
;
}
this
.
$emit
(
'
tab-remove
'
,
tab
);
this
.
$forceUpdate
();
},
handleTabClick
(
tab
,
event
)
{
if
(
tab
.
disabled
)
return
;
this
.
currentName
=
tab
.
index
;
this
.
$emit
(
'
tab-click
'
,
tab
,
event
);
},
...
...
packages/theme-default/src/tabs.css
View file @
3d125796
...
...
@@ -59,6 +59,11 @@
color
:
#1f2d3d
;
cursor
:
pointer
;
}
@when
disabled
{
color
:
var
(
--disabled-color-base
);
cursor
:
default
;
}
}
@e
content
{
overflow
:
hidden
;
...
...
test/unit/specs/tabs.spec.js
View file @
3d125796
...
...
@@ -241,4 +241,26 @@ describe('Tabs', () => {
done
();
});
});
it
(
'
disabled
'
,
done
=>
{
vm
=
createVue
({
template
:
`
<el-tabs type="card">
<el-tab-pane label="用户管理">A</el-tab-pane>
<el-tab-pane disabled label="配置管理" ref="disabled">B</el-tab-pane>
<el-tab-pane label="角色管理">C</el-tab-pane>
<el-tab-pane label="定时任务补偿">D</el-tab-pane>
</el-tabs>
`
},
true
);
vm
.
$nextTick
(
_
=>
{
let
tabList
=
vm
.
$el
.
querySelector
(
'
.el-tabs__header
'
).
children
;
tabList
[
1
].
click
();
vm
.
$nextTick
(
_
=>
{
expect
(
tabList
[
1
].
classList
.
contains
(
'
is-active
'
)).
to
.
not
.
true
;
done
();
});
});
});
});
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