Skip to content

Commit d68199d

Browse files
committedJun 12, 2018
feat: refine Badge's API
1 parent 0481a18 commit d68199d

File tree

2 files changed

+46
-30
lines changed

2 files changed

+46
-30
lines changed
 

‎lib/app/components/Badge.vue

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
<script>
2+
export default {
3+
functional: true,
4+
props: {
5+
type: {
6+
type: String,
7+
default: 'tip'
8+
},
9+
text: String,
10+
vertical: {
11+
type: String,
12+
default: 'top'
13+
}
14+
},
15+
render (h, { props, slots }) {
16+
return h('span', {
17+
class: ['badge', props.type, props.vertical]
18+
}, props.text || slots().default)
19+
}
20+
}
21+
</script>
22+
23+
<style lang="stylus">
24+
@import '../../default-theme/styles/config.styl'
25+
26+
.badge
27+
display inline-block
28+
font-size 14px
29+
height 18px
30+
line-height 18px
31+
border-radius 3px
32+
padding 0 6px
33+
color white
34+
margin-right 5px
35+
background-color #42b983
36+
&.middle
37+
vertical-align middle
38+
&.top
39+
vertical-align top
40+
&.tip, &.green
41+
background-color #42b983
42+
&.error
43+
background-color #DA5961 //#f66
44+
&.warning, &.warn, &.yellow
45+
background-color darken(#ffe564, 35%)
46+
</style>

‎lib/default-theme/Badge.vue

-30
This file was deleted.

0 commit comments

Comments
 (0)
Please sign in to comment.