Tag add type props,and optimize style
Tag add type props,and optimize style
This commit is contained in:
parent
a901da64ed
commit
382c000c8f
8 changed files with 146 additions and 17 deletions
2
dist/styles/iview.all.css
vendored
2
dist/styles/iview.all.css
vendored
File diff suppressed because one or more lines are too long
2
dist/styles/iview.css
vendored
2
dist/styles/iview.css
vendored
File diff suppressed because one or more lines are too long
|
@ -1,7 +1,6 @@
|
||||||
<template>
|
<template>
|
||||||
<div v-if="!closed" :class="classes" transition="fade">
|
<div v-if="!closed" :class="classes" transition="fade">
|
||||||
<span :class="textClasses"><slot></slot></span>
|
<span :class="dotClasses" v-if="showDot"></span><span :class="textClasses"><slot></slot></span><Icon v-if="closable" type="ios-close-empty" @click="close"></Icon>
|
||||||
<Icon v-if="closable" type="ios-close-empty" @click="close"></Icon>
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
|
@ -21,6 +20,11 @@
|
||||||
validator (value) {
|
validator (value) {
|
||||||
return oneOf(value, ['blue', 'green', 'red', 'yellow']);
|
return oneOf(value, ['blue', 'green', 'red', 'yellow']);
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
type: {
|
||||||
|
validator (value) {
|
||||||
|
return oneOf(value, ['border', 'dot']);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
data () {
|
data () {
|
||||||
|
@ -33,12 +37,20 @@
|
||||||
return [
|
return [
|
||||||
`${prefixCls}`,
|
`${prefixCls}`,
|
||||||
{
|
{
|
||||||
[`${prefixCls}-${this.color}`]: !!this.color
|
[`${prefixCls}-${this.color}`]: !!this.color,
|
||||||
|
[`${prefixCls}-${this.type}`]: !!this.type,
|
||||||
|
[`${prefixCls}-closable`]: this.closable
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
textClasses () {
|
textClasses () {
|
||||||
return `${prefixCls}-text`;
|
return `${prefixCls}-text`;
|
||||||
|
},
|
||||||
|
dotClasses () {
|
||||||
|
return `${prefixCls}-dot-inner`;
|
||||||
|
},
|
||||||
|
showDot () {
|
||||||
|
return !!this.type && this.type === 'dot';
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
|
|
@ -7,8 +7,8 @@
|
||||||
line-height: 22px;
|
line-height: 22px;
|
||||||
margin: 2px 4px 2px 0;
|
margin: 2px 4px 2px 0;
|
||||||
padding: 0 8px;
|
padding: 0 8px;
|
||||||
border-radius: @btn-border-radius-small;
|
|
||||||
border: 1px solid @border-color-split;
|
border: 1px solid @border-color-split;
|
||||||
|
border-radius: @btn-border-radius-small;
|
||||||
background: @background-color-base;
|
background: @background-color-base;
|
||||||
font-size: @tag-font-size;
|
font-size: @tag-font-size;
|
||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
|
@ -17,6 +17,77 @@
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
//.transition(all @transition-time @ease-in-out);
|
//.transition(all @transition-time @ease-in-out);
|
||||||
|
|
||||||
|
&-dot{
|
||||||
|
height: 32px;
|
||||||
|
line-height: 32px;
|
||||||
|
border: 1px solid @border-color-split !important;
|
||||||
|
color: @text-color !important;
|
||||||
|
background: #fff !important;
|
||||||
|
padding: 0 12px;
|
||||||
|
|
||||||
|
&-inner{
|
||||||
|
display: inline-block;
|
||||||
|
width: 12px;
|
||||||
|
height: 12px;
|
||||||
|
margin-right: 8px;
|
||||||
|
border-radius: 50%;
|
||||||
|
background: @border-color-split;
|
||||||
|
position: relative;
|
||||||
|
top: 1px;
|
||||||
|
}
|
||||||
|
.@{tag-close-prefix-cls} {
|
||||||
|
color: #666 !important;
|
||||||
|
margin-left: 12px !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&-border{
|
||||||
|
height: 24px;
|
||||||
|
line-height: 24px;
|
||||||
|
border: 1px solid @border-color-split !important;
|
||||||
|
color: @text-color !important;
|
||||||
|
background: #fff !important;
|
||||||
|
position: relative;
|
||||||
|
|
||||||
|
.@{tag-close-prefix-cls} {
|
||||||
|
color: #666 !important;
|
||||||
|
margin-left: 12px !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
&:after{
|
||||||
|
content: "";
|
||||||
|
display: none;
|
||||||
|
width: 1px;
|
||||||
|
background: @border-color-split;
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
bottom: 0;
|
||||||
|
right: 22px;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.@{tag-prefix-cls}-closable {
|
||||||
|
&:after{
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
.@{tag-close-prefix-cls} {
|
||||||
|
margin-left: 18px !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&.@{tag-prefix-cls}-blue {
|
||||||
|
color: @link-color !important;
|
||||||
|
}
|
||||||
|
&.@{tag-prefix-cls}-green {
|
||||||
|
color: @success-color !important;
|
||||||
|
}
|
||||||
|
&.@{tag-prefix-cls}-yellow {
|
||||||
|
color: @warning-color !important;
|
||||||
|
}
|
||||||
|
&.@{tag-prefix-cls}-red {
|
||||||
|
color: @error-color !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
opacity: 0.85;
|
opacity: 0.85;
|
||||||
}
|
}
|
||||||
|
@ -38,7 +109,7 @@
|
||||||
.@{tag-close-prefix-cls} {
|
.@{tag-close-prefix-cls} {
|
||||||
.iconfont-size-under-12px(20px);
|
.iconfont-size-under-12px(20px);
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
margin-left: 3px;
|
margin-left: 8px;
|
||||||
color: #666;
|
color: #666;
|
||||||
opacity: 0.66;
|
opacity: 0.66;
|
||||||
position: relative;
|
position: relative;
|
||||||
|
@ -64,25 +135,27 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
&-blue {
|
&-blue,
|
||||||
|
&-blue&-dot &-dot-inner
|
||||||
|
{
|
||||||
background: @link-color;
|
background: @link-color;
|
||||||
}
|
}
|
||||||
|
|
||||||
&-green {
|
&-green,
|
||||||
|
&-green&-dot &-dot-inner
|
||||||
|
{
|
||||||
background: @success-color;
|
background: @success-color;
|
||||||
}
|
}
|
||||||
|
|
||||||
&-yellow {
|
&-yellow,
|
||||||
|
&-yellow&-dot &-dot-inner
|
||||||
|
{
|
||||||
background: @warning-color;
|
background: @warning-color;
|
||||||
}
|
}
|
||||||
|
|
||||||
&-red {
|
&-red,
|
||||||
|
&-red&-dot &-dot-inner
|
||||||
|
{
|
||||||
background: @error-color;
|
background: @error-color;
|
||||||
}
|
}
|
||||||
|
|
||||||
&-close {
|
|
||||||
width: 0 !important;
|
|
||||||
padding: 0;
|
|
||||||
margin: 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -37,6 +37,7 @@ li + li {
|
||||||
<li><a v-link="'/step'">Step</a></li>
|
<li><a v-link="'/step'">Step</a></li>
|
||||||
<li><a v-link="'/switch'">Switch</a></li>
|
<li><a v-link="'/switch'">Switch</a></li>
|
||||||
<li><a v-link="'/alert'">Alert</a></li>
|
<li><a v-link="'/alert'">Alert</a></li>
|
||||||
|
<li><a v-link="'/tag'">Tag</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</nav>
|
</nav>
|
||||||
<router-view></router-view>
|
<router-view></router-view>
|
||||||
|
|
|
@ -75,6 +75,11 @@ router.map({
|
||||||
component: function (resolve) {
|
component: function (resolve) {
|
||||||
require(['./routers/alert.vue'], resolve);
|
require(['./routers/alert.vue'], resolve);
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
'/tag': {
|
||||||
|
component: function (resolve) {
|
||||||
|
require(['./routers/tag.vue'], resolve);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
<Page :total="40" size="small"></Page>
|
<Page :total="40" size="small"></Page>
|
||||||
<Page :total="40" size="small" show-elevator show-sizer></Page>
|
<Page :total="40" size="small" show-elevator show-sizer></Page>
|
||||||
<Page :total="40" size="small" show-total></Page>
|
<Page :total="40" size="small" show-total></Page>
|
||||||
|
<Page :total="100" show-sizer :page-size="5" :page-size-opts="[5,10,15,20]"></Page>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import { Modal, Button, Message, Page } from 'iview';
|
import { Modal, Button, Message, Page } from 'iview';
|
||||||
|
|
37
test/routers/tag.vue
Normal file
37
test/routers/tag.vue
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
<template>
|
||||||
|
<Tag>标签一</Tag>
|
||||||
|
<Tag>标签二</Tag>
|
||||||
|
<Tag closable>标签三</Tag>
|
||||||
|
<Tag closable color="blue">标签一</Tag>
|
||||||
|
<Tag closable color="green">标签二</Tag>
|
||||||
|
<Tag closable color="red">标签三</Tag>
|
||||||
|
<Tag closable color="yellow">标签四</Tag>
|
||||||
|
<br><br>
|
||||||
|
<Tag type="dot">标签一</Tag>
|
||||||
|
<Tag type="dot" closable>标签一</Tag>
|
||||||
|
<Tag type="dot" color="blue">标签一</Tag>
|
||||||
|
<Tag type="dot" color="blue" closable>标签一</Tag>
|
||||||
|
<Tag type="dot" color="green">标签一</Tag>
|
||||||
|
<Tag type="dot" color="green" closable>标签一</Tag>
|
||||||
|
<Tag type="dot" color="red">标签一</Tag>
|
||||||
|
<Tag type="dot" color="red" closable>标签一</Tag>
|
||||||
|
<Tag type="dot" color="yellow">标签一</Tag>
|
||||||
|
<Tag type="dot" color="yellow" closable>标签一</Tag>
|
||||||
|
<br><br>
|
||||||
|
<Tag type="border">标签一</Tag>
|
||||||
|
<Tag type="border" closable>标签一</Tag>
|
||||||
|
<Tag type="border" color="blue">标签一</Tag>
|
||||||
|
<Tag type="border" color="blue" closable>标签一</Tag>
|
||||||
|
<Tag type="border" color="green">标签一</Tag>
|
||||||
|
<Tag type="border" color="green" closable>标签一</Tag>
|
||||||
|
<Tag type="border" color="red">标签一</Tag>
|
||||||
|
<Tag type="border" color="red" closable>标签一</Tag>
|
||||||
|
<Tag type="border" color="yellow">标签一</Tag>
|
||||||
|
<Tag type="border" color="yellow" closable>标签一</Tag>
|
||||||
|
</template>
|
||||||
|
<script>
|
||||||
|
import { Tag } from 'iview';
|
||||||
|
export default {
|
||||||
|
components: { Tag }
|
||||||
|
}
|
||||||
|
</script>
|
Loading…
Add table
Reference in a new issue