张延森 3 lat temu
rodzic
commit
5a5a9f1f23

+ 4
- 1
src/components/barcode/index.jsx Wyświetl plik

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

+ 15
- 0
src/components/barcode/style.less Wyświetl plik

@@ -1,4 +1,6 @@
1 1
 .barcode-box {
2
+  position: relative;
3
+
2 4
   .barcode-txt {
3 5
     display: flex;
4 6
     justify-content: space-between;
@@ -12,4 +14,17 @@
12 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
 }