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
89177043
Commit
89177043
authored
Dec 13, 2016
by
baiyaaaaa
Committed by
杨奕
Dec 13, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
support tag color property
parent
998dcce2
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
21 additions
and
8 deletions
+21
-8
examples/docs/en-US/tag.md
examples/docs/en-US/tag.md
+2
-1
examples/docs/zh-CN/tag.md
examples/docs/zh-CN/tag.md
+2
-1
packages/tag/src/tag.vue
packages/tag/src/tag.vue
+4
-2
packages/theme-default/src/common/var.css
packages/theme-default/src/common/var.css
+0
-1
packages/theme-default/src/tag.css
packages/theme-default/src/tag.css
+4
-3
test/unit/specs/tag.spec.js
test/unit/specs/tag.spec.js
+9
-0
No files found.
examples/docs/en-US/tag.md
View file @
89177043
...
...
@@ -34,7 +34,7 @@ Used for marking and selection.
### Basic usage
::: demo Use the
`type`
attribute to define Tag's type.
::: demo Use the
`type`
attribute to define Tag's type.
In addition, the
`color`
attribute can be used to set the background color of the Tag.
```
html
<el-tag>
Tag One
</el-tag>
...
...
@@ -93,6 +93,7 @@ Used for marking and selection.
| closable | whether Tab can be removed | boolean | — | false |
| close-transition | whether the removal animation is disabled | boolean | — | false |
| hit | whether Tag has a highlighted border | boolean | — | false |
| color | background color of the tag | string | — | — |
### Events
...
...
examples/docs/zh-CN/tag.md
View file @
89177043
...
...
@@ -34,7 +34,7 @@
### 基础用法
:::demo 由
`type`
属性来
定义,该属性可选填
。
:::demo 由
`type`
属性来
选择tag的类型,也可以通过
`color`
属性来自定义背景色
。
```
html
<el-tag>
标签一
</el-tag>
...
...
@@ -93,6 +93,7 @@
| closable | 是否可关闭 | boolean | — | false |
| close-transition | 是否禁用关闭时的渐变动画 | boolean | — | false |
| hit | 是否有边框描边 | boolean | — | false |
| color | 背景色 | string | — | — |
### Events
...
...
packages/tag/src/tag.vue
View file @
89177043
...
...
@@ -2,7 +2,8 @@
<transition
:name=
"closeTransition ? '' : 'el-zoom-in-center'"
>
<span
class=
"el-tag"
:class=
"[type ? 'el-tag--' + type : '',
{'is-hit': hit}]">
:class=
"[type ? 'el-tag--' + type : '',
{'is-hit': hit}]"
:style="{backgroundColor: color}">
<slot></slot>
<i
class=
"el-tag__close el-icon-close"
v-if=
"closable"
...
...
@@ -18,7 +19,8 @@
closable
:
Boolean
,
type
:
String
,
hit
:
Boolean
,
closeTransition
:
Boolean
closeTransition
:
Boolean
,
color
:
String
},
methods
:
{
handleClose
(
event
)
{
...
...
packages/theme-default/src/common/var.css
View file @
89177043
...
...
@@ -440,7 +440,6 @@
-------------------------- */
--tag-padding
:
0
5px
;
--tag-fill
:
var
(
--border-color-hover
);
--tag-border
:
var
(
--border-color-hover
);
--tag-color
:
var
(
--color-white
);
--tag-close-color
:
#666
;
--tag-font-size
:
12px
;
...
...
packages/theme-default/src/tag.css
View file @
89177043
...
...
@@ -7,12 +7,13 @@
background-color
:
var
(
--tag-fill
);
display
:
inline-block
;
padding
:
var
(
--tag-padding
);
height
:
2
2
px
;
line-height
:
@
height
;
height
:
2
4
px
;
line-height
:
calc
(
@
height
-
2
)
;
font-size
:
var
(
--tag-font-size
);
color
:
var
(
--tag-color
);
border-radius
:
var
(
--tag-border-radius
);
border
:
1px
solid
var
(
--tag-border
);
box-sizing
:
border-box
;
border
:
1px
solid
transparent
;
&
.el-icon-close
{
border-radius
:
50%
;
...
...
test/unit/specs/tag.spec.js
View file @
89177043
...
...
@@ -78,4 +78,13 @@ describe('Tag', () => {
},
true
);
expect
(
vm
.
$el
.
classList
.
contains
(
'
md-fade-center
'
)).
to
.
be
.
false
;
});
it
(
'
color
'
,
()
=>
{
vm
=
createVue
({
template
:
`
<el-tag color="rgb(0, 0, 0)"></el-tag>
`
},
true
);
expect
(
vm
.
$el
.
style
.
backgroundColor
).
to
.
equal
(
'
rgb(0, 0, 0)
'
);
});
});
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