张延森 3 年之前
父節點
當前提交
5a5a9f1f23
共有 2 個檔案被更改,包括 19 行新增1 行删除
  1. 4
    1
      src/components/barcode/index.jsx
  2. 15
    0
      src/components/barcode/style.less

+ 4
- 1
src/components/barcode/index.jsx 查看文件

57
       <Canvas style={style} type='2d' id={id}></Canvas>
57
       <Canvas style={style} type='2d' id={id}></Canvas>
58
       {
58
       {
59
         codeVisible && <CodeText code={code} />
59
         codeVisible && <CodeText code={code} />
60
-      }      
60
+      }
61
+      {
62
+        !code && <View className='no-barcode'>暂无条码</View>
63
+      }
61
     </View>
64
     </View>
62
   )
65
   )
63
 }
66
 }

+ 15
- 0
src/components/barcode/style.less 查看文件

1
 .barcode-box {
1
 .barcode-box {
2
+  position: relative;
3
+
2
   .barcode-txt {
4
   .barcode-txt {
3
     display: flex;
5
     display: flex;
4
     justify-content: space-between;
6
     justify-content: space-between;
12
       flex: 1;
14
       flex: 1;
13
     }
15
     }
14
   }
16
   }
17
+
18
+  .no-barcode {
19
+    position: absolute;
20
+    width: 100%;
21
+    height: 100%;
22
+    font-size: 2em;
23
+    color: rgba(0, 0, 0, .5);
24
+    line-height: 3em;
25
+    z-index: 100;
26
+    top: 0;
27
+    left: 0;
28
+    text-align: center;
29
+  }
15
 }
30
 }