Browse Source

fix(tag): del class nut-tag repeat

richard1015 4 years ago
parent
commit
5a3f44d934

+ 2 - 1
src/packages/__VUE/tag/index.scss

@@ -3,6 +3,7 @@
   display: inline-flex;
   align-items: center;
   font-size: $tag-font-size;
+  border-radius: $tag-default-border-radius;
   &--default {
     color: $tag-default-color;
     background: $tag-default-background-color;
@@ -34,7 +35,7 @@
   }
 
   &--round {
-    border-radius: 8px;
+    border-radius: $tag-round-border-radius;
   }
 
   &--mark {

+ 4 - 6
src/packages/__VUE/tag/index.taro.vue

@@ -1,9 +1,7 @@
 <template>
   <view :class="classes" :style="getStyle()">
-    <view class="nut-tag">
-      <slot></slot>
-      <nut-icon class="nut-tag--close" v-if="closeable" name="close" size="11" @click="onClose"></nut-icon>
-    </view>
+    <slot></slot>
+    <nut-icon class="nut-tag--close" v-if="closeable" name="close" size="11" @click="onClose"></nut-icon>
   </view>
 </template>
 
@@ -16,8 +14,8 @@ export type TagType = 'primary' | 'success' | 'danger' | 'warning';
 
 export default create({
   props: {
-    color: String,
-    textColor: String,
+    color: { type: String, default: '' },
+    textColor: { type: String, default: '' },
     type: {
       type: String as PropType<TagType>,
       default: 'default'

+ 4 - 6
src/packages/__VUE/tag/index.vue

@@ -1,9 +1,7 @@
 <template>
   <view :class="classes" :style="getStyle()">
-    <view class="nut-tag">
-      <slot></slot>
-      <nut-icon class="nut-tag--close" v-if="closeable" name="close" size="12" @click="onClose"></nut-icon>
-    </view>
+    <slot></slot>
+    <nut-icon class="nut-tag--close" v-if="closeable" name="close" size="12" @click="onClose"></nut-icon>
   </view>
 </template>
 
@@ -15,8 +13,8 @@ export type TagType = 'primary' | 'success' | 'danger' | 'warning';
 
 export default create({
   props: {
-    color: String,
-    textColor: String,
+    color: { type: String, default: '' },
+    textColor: { type: String, default: '' },
     type: {
       type: String as PropType<TagType>,
       default: 'default'

+ 2 - 0
src/packages/styles/variables.scss

@@ -285,6 +285,8 @@ $timedetail-time-text-color: #999 !default;
 $timedetail-time-font-size: $font-size-1 !default;
 //tag
 $tag-font-size: 12px !default;
+$tag-default-border-radius: 4px !default;
+$tag-round-border-radius: 8px !default;
 $tag-default-background-color: #000000 !default;
 $tag-primary-background-color: #3460fa !default;
 $tag-success-background-color: #4fc08d !default;