ソースを参照

add z-index;fixed the shape when it has one word。

杨磊 7 年 前
コミット
25fdb07d7b

+ 2 - 0
src/packages/badge/badge.scss

@@ -4,9 +4,11 @@
     sup {
     sup {
       position: absolute;
       position: absolute;
       height: 18px;
       height: 18px;
+      min-width: 8px;
       line-height: 18px;
       line-height: 18px;
       padding: 0 5px;
       padding: 0 5px;
       background-color: #fff;
       background-color: #fff;
+      text-align: center;
       border: 1px solid $primary-color;
       border: 1px solid $primary-color;
       color: $primary-color;
       color: $primary-color;
       font-size: 10px;
       font-size: 10px;

+ 6 - 1
src/packages/badge/badge.vue

@@ -36,13 +36,18 @@ export default {
     right: {
     right: {
       type: String,
       type: String,
       default: '0'
       default: '0'
+    },
+    zIndex: {
+      type: Number,
+      default: 10
     }
     }
   },
   },
   data() {
   data() {
     return {
     return {
       stl: {
       stl: {
         top: this.top,
         top: this.top,
-        right: this.right
+        right: this.right,
+        zIndex: this.zIndex
       }
       }
     }
     }
   },
   },

+ 1 - 1
src/packages/badge/demo.vue

@@ -24,7 +24,7 @@
       <h4>小圆点</h4>
       <h4>小圆点</h4>
       <div class="demo-w">
       <div class="demo-w">
         <nut-badge :isDot="true" class="item"><div class="demo-svg"></div></nut-badge>
         <nut-badge :isDot="true" class="item"><div class="demo-svg"></div></nut-badge>
-        <nut-badge :isDot="true" class="item">文字内容</nut-badge>
+        <nut-badge :isDot="true" class="item">购物车</nut-badge>
         <nut-badge :isDot="true" :max="99" class="item"><nut-button>购物车</nut-button></nut-badge>
         <nut-badge :isDot="true" :max="99" class="item"><nut-button>购物车</nut-button></nut-badge>
       </div>
       </div>
 
 

+ 1 - 0
src/packages/badge/doc.md

@@ -136,6 +136,7 @@
 |----- | ----- | ----- | ----- 
 |----- | ----- | ----- | ----- 
 | value | 显示的内容 | String | -
 | value | 显示的内容 | String | -
 | max | value为数值时,最大值 | Number | 10000
 | max | value为数值时,最大值 | Number | 10000
+| zIndex | 徽标的z-index值 | Number | 10
 | isDot | 是否为小点 | Boolean | false
 | isDot | 是否为小点 | Boolean | false
 | hidden | 是否隐藏 | Boolean | false
 | hidden | 是否隐藏 | Boolean | false
 | top   | 上下偏移量,支持单位设置,可设置为:5px、5rem等 | String | 0
 | top   | 上下偏移量,支持单位设置,可设置为:5px、5rem等 | String | 0