Tag: add chalk theme

pull/7026/head
Leopoldthecoder 2017-09-14 15:33:21 +08:00 committed by 杨奕
parent 34dc51bb8b
commit f01df258f4
4 changed files with 137 additions and 99 deletions

View File

@ -4,11 +4,10 @@
return { return {
tags: [ tags: [
{ name: 'Tag 1', type: '' }, { name: 'Tag 1', type: '' },
{ name: 'Tag 2', type: 'gray' }, { name: 'Tag 2', type: 'success' },
{ name: 'Tag 3', type: 'primary' }, { name: 'Tag 3', type: 'info' },
{ name: 'Tag 4', type: 'success' }, { name: 'Tag 4', type: 'warning' },
{ name: 'Tag 5', type: 'warning' }, { name: 'Tag 5', type: 'danger' }
{ name: 'Tag 6', type: 'danger' }
], ],
dynamicTags: ['Tag 1', 'Tag 2', 'Tag 3'], dynamicTags: ['Tag 1', 'Tag 2', 'Tag 3'],
inputVisible: false, inputVisible: false,
@ -46,17 +45,17 @@
} }
.button-new-tag { .button-new-tag {
margin-left: 10px; margin-left: 10px;
height: 24px; height: 30px;
line-height: 22px; line-height: 28px;
padding: 0 *; padding: 0 *;
} }
.input-new-tag { .input-new-tag {
width: 78px; width: 90px;
margin-left: 10px; margin-left: 10px;
vertical-align: bottom; vertical-align: bottom;
.el-input__inner { .el-input__inner {
height: 24px; height: 30px;
} }
} }
} }
@ -72,11 +71,10 @@ Used for marking and selection.
```html ```html
<el-tag>Tag One</el-tag> <el-tag>Tag One</el-tag>
<el-tag type="gray">Tag Two</el-tag> <el-tag type="success">Tag Two</el-tag>
<el-tag type="primary">Tag Three</el-tag> <el-tag type="info">Tag Three</el-tag>
<el-tag type="success">Tag Four</el-tag> <el-tag type="warning">Tag Four</el-tag>
<el-tag type="warning">Tag Five</el-tag> <el-tag type="danger">Tag Five</el-tag>
<el-tag type="danger">Tag Six</el-tag>
``` ```
::: :::
@ -88,10 +86,9 @@ Used for marking and selection.
<el-tag <el-tag
v-for="tag in tags" v-for="tag in tags"
:key="tag.name" :key="tag.name"
:closable="true" closable
:type="tag.type" :type="tag.type">
> {{tag.name}}
{{tag.name}}
</el-tag> </el-tag>
<script> <script>
@ -100,11 +97,10 @@ Used for marking and selection.
return { return {
tags: [ tags: [
{ name: 'Tag 1', type: '' }, { name: 'Tag 1', type: '' },
{ name: 'Tag 2', type: 'gray' }, { name: 'Tag 2', type: 'success' },
{ name: 'Tag 3', type: 'primary' }, { name: 'Tag 3', type: 'info' },
{ name: 'Tag 4', type: 'success' }, { name: 'Tag 4', type: 'warning' },
{ name: 'Tag 5', type: 'warning' }, { name: 'Tag 5', type: 'danger' }
{ name: 'Tag 6', type: 'danger' }
] ]
}; };
} }
@ -122,11 +118,10 @@ You can use the `close` event to add and remove tag dynamically.
<el-tag <el-tag
:key="tag" :key="tag"
v-for="tag in dynamicTags" v-for="tag in dynamicTags"
:closable="true" closable
:close-transition="false" :close-transition="false"
@close="handleClose(tag)" @close="handleClose(tag)">
> {{tag}}
{{tag}}
</el-tag> </el-tag>
<el-input <el-input
class="input-new-tag" class="input-new-tag"
@ -139,6 +134,28 @@ You can use the `close` event to add and remove tag dynamically.
> >
</el-input> </el-input>
<el-button v-else class="button-new-tag" size="small" @click="showInput">+ New Tag</el-button> <el-button v-else class="button-new-tag" size="small" @click="showInput">+ New Tag</el-button>
<style>
.el-tag + .el-tag {
margin-left: 10px;
}
.button-new-tag {
margin-left: 10px;
height: 30px;
line-height: 28px;
padding-top: 0;
padding-bottom: 0;
}
.input-new-tag {
width: 90px;
margin-left: 10px;
vertical-align: bottom;
}
.el-input__inner {
height: 30px;
}
</style>
<script> <script>
export default { export default {
data() { data() {
@ -177,14 +194,14 @@ You can use the `close` event to add and remove tag dynamically.
### Attributes ### Attributes
| Attribute | Description | Type | Accepted Values | Default | | Attribute | Description | Type | Accepted Values | Default |
|---------- |-------------- |---------- |-------------------------------- |-------- | |---------- |-------------- |---------- |-------------------------------- |-------- |
| type | theme | string | primary/gray/success/warning/danger | — | | type | theme | string | success/info/warning/danger | — |
| closable | whether Tab can be removed | boolean | — | false | | closable | whether Tag can be removed | boolean | — | false |
| close-transition | whether to disable animations | boolean | — | false | | close-transition | whether to disable animations | boolean | — | false |
| hit | whether Tag has a highlighted border | boolean | — | false | | hit | whether Tag has a highlighted border | boolean | — | false |
| color | background color of the tag | string | — | — | | color | background color of the Tag | string | — | — |
### Events ### Events
| Event Name | Description | Parameters | | Event Name | Description | Parameters |
|---------- |-------- |---------- | |---------- |-------- |---------- |
| close | triggers when Tab is removed | — | | close | triggers when Tag is removed | — |

View File

@ -4,11 +4,10 @@
return { return {
tags: [ tags: [
{ name: '标签一', type: '' }, { name: '标签一', type: '' },
{ name: '标签二', type: 'gray' }, { name: '标签二', type: 'success' },
{ name: '标签三', type: 'primary' }, { name: '标签三', type: 'info' },
{ name: '标签四', type: 'success' }, { name: '标签四', type: 'warning' },
{ name: '标签五', type: 'warning' }, { name: '标签五', type: 'danger' }
{ name: '标签六', type: 'danger' }
], ],
dynamicTags: ['标签一', '标签二', '标签三'], dynamicTags: ['标签一', '标签二', '标签三'],
inputVisible: false, inputVisible: false,
@ -46,17 +45,17 @@
} }
.button-new-tag { .button-new-tag {
margin-left: 10px; margin-left: 10px;
height: 24px; height: 30px;
line-height: 22px; line-height: 28px;
padding: 0 *; padding: 0 *;
} }
.input-new-tag { .input-new-tag {
width: 78px; width: 90px;
margin-left: 10px; margin-left: 10px;
vertical-align: bottom; vertical-align: bottom;
.el-input__inner { .el-input__inner {
height: 24px; height: 30px;
} }
} }
} }
@ -72,11 +71,10 @@
```html ```html
<el-tag>标签一</el-tag> <el-tag>标签一</el-tag>
<el-tag type="gray">标签二</el-tag> <el-tag type="success">标签二</el-tag>
<el-tag type="primary">标签三</el-tag> <el-tag type="info">标签三</el-tag>
<el-tag type="success">标签四</el-tag> <el-tag type="warning">标签四</el-tag>
<el-tag type="warning">标签五</el-tag> <el-tag type="danger">标签五</el-tag>
<el-tag type="danger">标签六</el-tag>
``` ```
::: :::
@ -88,10 +86,9 @@
<el-tag <el-tag
v-for="tag in tags" v-for="tag in tags"
:key="tag.name" :key="tag.name"
:closable="true" closable
:type="tag.type" :type="tag.type">
> {{tag.name}}
{{tag.name}}
</el-tag> </el-tag>
<script> <script>
@ -100,11 +97,10 @@
return { return {
tags: [ tags: [
{ name: '标签一', type: '' }, { name: '标签一', type: '' },
{ name: '标签二', type: 'gray' }, { name: '标签二', type: 'success' },
{ name: '标签三', type: 'primary' }, { name: '标签三', type: 'info' },
{ name: '标签四', type: 'success' }, { name: '标签四', type: 'warning' },
{ name: '标签五', type: 'warning' }, { name: '标签五', type: 'danger' }
{ name: '标签六', type: 'danger' }
] ]
}; };
} }
@ -122,11 +118,10 @@
<el-tag <el-tag
:key="tag" :key="tag"
v-for="tag in dynamicTags" v-for="tag in dynamicTags"
:closable="true" closable
:close-transition="false" :close-transition="false"
@close="handleClose(tag)" @close="handleClose(tag)">
> {{tag}}
{{tag}}
</el-tag> </el-tag>
<el-input <el-input
class="input-new-tag" class="input-new-tag"
@ -139,6 +134,28 @@
> >
</el-input> </el-input>
<el-button v-else class="button-new-tag" size="small" @click="showInput">+ New Tag</el-button> <el-button v-else class="button-new-tag" size="small" @click="showInput">+ New Tag</el-button>
<style>
.el-tag + .el-tag {
margin-left: 10px;
}
.button-new-tag {
margin-left: 10px;
height: 30px;
line-height: 28px;
padding-top: 0;
padding-bottom: 0;
}
.input-new-tag {
width: 90px;
margin-left: 10px;
vertical-align: bottom;
}
.el-input__inner {
height: 30px;
}
</style>
<script> <script>
export default { export default {
data() { data() {
@ -177,7 +194,7 @@
### Attributes ### Attributes
| 参数 | 说明 | 类型 | 可选值 | 默认值 | | 参数 | 说明 | 类型 | 可选值 | 默认值 |
|---------- |-------------- |---------- |-------------------------------- |-------- | |---------- |-------------- |---------- |-------------------------------- |-------- |
| type | 主题 | string | primary/gray/success/warning/danger | — | | type | 主题 | string | success/info/warning/danger | — |
| closable | 是否可关闭 | boolean | — | false | | closable | 是否可关闭 | boolean | — | false |
| close-transition | 是否禁用渐变动画 | boolean | — | false | | close-transition | 是否禁用渐变动画 | boolean | — | false |
| hit | 是否有边框描边 | boolean | — | false | | hit | 是否有边框描边 | boolean | — | false |
@ -187,4 +204,4 @@
### Events ### Events
| 事件名称 | 说明 | 回调参数 | | 事件名称 | 说明 | 回调参数 |
|---------- |-------- |---------- | |---------- |-------- |---------- |
| close | 关闭tag时触发的事件 | — | | close | 关闭 Tag 时触发的事件 | — |

View File

@ -506,31 +506,31 @@ $--tooltip-padding: 10px;
/* Tag /* Tag
-------------------------- */ -------------------------- */
$--tag-padding: 0 5px; $--tag-padding: 0 10px;
$--tag-fill: $--border-color-hover; $--tag-fill: rgba($--color-primary, 0.10);
$--tag-color: $--color-white; $--tag-color: $--color-primary;
$--tag-close-color: #666; $--tag-border: rgba($--color-primary, 0.20);
$--tag-font-size: 12px; $--tag-font-size: 12px;
$--tag-border-radius: 4px; $--tag-border-radius: 4px;
$--tag-gray-fill: $--color-text-secondary; $--tag-info-fill: rgba($--color-info, 0.10);
$--tag-gray-border: $--color-text-secondary; $--tag-info-border: rgba($--color-info, 0.20);
$--tag-gray-color: $--link-color; $--tag-info-color: $--color-info;
$--tag-primary-fill: rgba($--color-primary,0.10); $--tag-primary-fill: rgba($--color-primary, 0.10);
$--tag-primary-border: rgba($--color-primary,0.20); $--tag-primary-border: rgba($--color-primary, 0.20);
$--tag-primary-color: $--color-primary; $--tag-primary-color: $--color-primary;
$--tag-success-fill: rgba(18,206,102,0.10); $--tag-success-fill: rgba($--color-success, 0.10);
$--tag-success-border: rgba(18,206,102,0.20); $--tag-success-border: rgba($--color-success, 0.20);
$--tag-success-color: $--color-success; $--tag-success-color: $--color-success;
$--tag-warning-fill: rgba(247,186,41,0.10); $--tag-warning-fill: rgba($--color-warning, 0.10);
$--tag-warning-border: rgba(247,186,41,0.20); $--tag-warning-border: rgba($--color-warning, 0.20);
$--tag-warning-color: $--color-warning; $--tag-warning-color: $--color-warning;
$--tag-danger-fill: rgba(255,73,73,0.10); $--tag-danger-fill: rgba($--color-danger, 0.10);
$--tag-danger-border: rgba(255,73,73,0.20); $--tag-danger-border: rgba($--color-danger, 0.20);
$--tag-danger-color: $--color-danger; $--tag-danger-color: $--color-danger;
/* Tree /* Tree

View File

@ -5,13 +5,13 @@
background-color: $--tag-fill; background-color: $--tag-fill;
display: inline-block; display: inline-block;
padding: $--tag-padding; padding: $--tag-padding;
height: 24px; height: 30px;
line-height: 22px; line-height: 28px;
font-size: $--tag-font-size; font-size: $--tag-font-size;
color: $--tag-color; color: $--tag-color;
border-radius: $--tag-border-radius; border-radius: $--tag-border-radius;
box-sizing: border-box; box-sizing: border-box;
border: 1px solid transparent; border: 1px solid $--tag-border;
white-space: nowrap; white-space: nowrap;
& .el-icon-close { & .el-icon-close {
@ -27,36 +27,28 @@
vertical-align: middle; vertical-align: middle;
top: -1px; top: -1px;
right: -2px; right: -2px;
color: $--tag-color;
&:hover { &:hover {
background-color: $--color-white; background-color: $--tag-color;
color: $--tag-fill;
}
}
@include m(gray) {
background-color: $--tag-gray-fill;
border-color: $--tag-gray-border;
color: $--tag-gray-color;
@include when(hit) {
border-color: $--tag-gray-color;
}
& .el-tag__close:hover {
background-color: $--tag-gray-color;
color: $--color-white; color: $--color-white;
} }
} }
@include m(primary) {
background-color: $--tag-primary-fill; @include m(info) {
border-color: $--tag-primary-border; background-color: $--tag-info-fill;
color: $--tag-primary-color; border-color: $--tag-info-border;
color: $--tag-info-color;
@include when(hit) { @include when(hit) {
border-color: $--tag-primary-color; border-color: $--tag-info-color;
}
& .el-tag__close {
color: $--tag-info-color;
} }
& .el-tag__close:hover { & .el-tag__close:hover {
background-color: $--tag-primary-color; background-color: $--tag-info-color;
color: $--color-white; color: $--color-white;
} }
} }
@ -68,6 +60,10 @@
border-color: $--tag-success-color; border-color: $--tag-success-color;
} }
& .el-tag__close {
color: $--tag-success-color;
}
& .el-tag__close:hover { & .el-tag__close:hover {
background-color: $--tag-success-color; background-color: $--tag-success-color;
color: $--color-white; color: $--color-white;
@ -81,6 +77,10 @@
border-color: $--tag-warning-color; border-color: $--tag-warning-color;
} }
& .el-tag__close {
color: $--tag-warning-color;
}
& .el-tag__close:hover { & .el-tag__close:hover {
background-color: $--tag-warning-color; background-color: $--tag-warning-color;
color: $--color-white; color: $--color-white;
@ -94,6 +94,10 @@
border-color: $--tag-danger-color; border-color: $--tag-danger-color;
} }
& .el-tag__close {
color: $--tag-danger-color;
}
& .el-tag__close:hover { & .el-tag__close:hover {
background-color: $--tag-danger-color; background-color: $--tag-danger-color;
color: $--color-white; color: $--color-white;