11<template >
2- <text v-if =" text" :class =" inverted ? 'uni-badge-- ' + type + ' uni-badge--' + size + ' uni-badge--' + type + '- inverted' : 'uni-badge-- ' + type + ' uni-badge--' + size" class =" uni-badge" :style = " width " @click =" onClick()" >{{ text }}</text >
2+ <text v-if =" text" :class =" inverted ? 'uni-badge-' + type + ' uni-badge--' + size + ' uni-badge-inverted' : 'uni-badge-' + type + ' uni-badge--' + size" class =" uni-badge" @click =" onClick()" >{{ text }}</text >
33</template >
44
55<script >
1818 type: String ,
1919 default: ' '
2020 },
21- size: {
22- // small.normal
21+ size: { // small.normal
2322 type: String ,
2423 default: ' normal'
2524 }
2625 },
27- data () {
28- return {
29- width: ` display: inline-block;width: ${ this .text .length * 15 + 25 } rpx`
30- };
31- },
3226 methods: {
3327 onClick () {
34- this .$emit (' click' );
28+ this .$emit (' click' )
3529 }
3630 }
37- };
31+ }
3832 </script >
3933
40- <style scoped>
34+ <style >
35+ @charset "UTF-8";
36+
4137 .uni-badge {
42- /* #ifndef APP-PLUS */
43- display : flex ;
44- /* #endif */
45- flex-direction : row ;
46- height : 40 rpx;
47- line-height : 40 rpx;
48- color : #333 ;
49- border-radius : 100px ;
50- background-color : #f1f1f1 ;
51- background-color : transparent ;
52- text-align : center ;
5338 font-family : ' Helvetica Neue' , Helvetica , sans-serif ;
39+ box-sizing : border-box ;
5440 font-size : 12px ;
55- padding : 0 ;
56- }
57-
58- .uni-badge--inverted {
59- padding : 0 5px 0 0 ;
60- color : #f1f1f1 ;
61- }
62-
63- .uni-badge--default {
41+ line-height : 1 ;
42+ display : inline-block ;
43+ padding : 3px 6px ;
6444 color : #333 ;
65- background-color : #f1f1f1 ;
45+ border-radius : 100px ;
46+ background-color : #f1f1f1
6647 }
6748
68- .uni-badge--default-inverted {
49+ .uni-badge.uni-badge-inverted {
50+ padding : 0 5px 0 0 ;
6951 color : #999 ;
70- background-color : transparent ;
52+ background-color : transparent
7153 }
7254
73- .uni-badge-- primary {
55+ .uni-badge-primary {
7456 color : #fff ;
75- background-color : #007aff ;
57+ background-color : #007aff
7658 }
7759
78- .uni-badge-- primary-inverted {
60+ .uni-badge-primary.uni-badge -inverted {
7961 color : #007aff ;
80- background-color : transparent ;
62+ background-color : transparent
8163 }
8264
83- .uni-badge-- success {
65+ .uni-badge-success {
8466 color : #fff ;
85- background-color : #4cd964 ;
67+ background-color : #4cd964
8668 }
8769
88- .uni-badge-- success-inverted {
70+ .uni-badge-success.uni-badge -inverted {
8971 color : #4cd964 ;
90- background-color : transparent ;
72+ background-color : transparent
9173 }
9274
93- .uni-badge-- warning {
75+ .uni-badge-warning {
9476 color : #fff ;
95- background-color : #f0ad4e ;
77+ background-color : #f0ad4e
9678 }
9779
98- .uni-badge-- warning-inverted {
80+ .uni-badge-warning.uni-badge -inverted {
9981 color : #f0ad4e ;
100- background-color : transparent ;
82+ background-color : transparent
10183 }
10284
103- .uni-badge-- error {
85+ .uni-badge-error {
10486 color : #fff ;
105- background-color : #dd524d ;
87+ background-color : #dd524d
10688 }
10789
108- .uni-badge-- error-inverted {
90+ .uni-badge-error.uni-badge -inverted {
10991 color : #dd524d ;
110- background-color : transparent ;
92+ background-color : transparent
11193 }
11294
11395 .uni-badge--small {
114- transform : scale (0 .8 );
115- transform-origin : center center ;
96+ transform : scale (.8 );
97+ transform-origin : center center
11698 }
11799 </style >
0 commit comments