|
@@ -2,7 +2,8 @@
|
|
|
<svg :id="barcodeId" :style="computeStyle"/>
|
|
|
</template>
|
|
|
|
|
|
-<script>
|
|
|
+<script lang="js">
|
|
|
+import system from '@/utils/system'
|
|
|
import JsBarcode from 'jsbarcode';
|
|
|
|
|
|
export default {
|
|
@@ -27,16 +28,11 @@ export default {
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
- barcodeId: 'barcode'
|
|
|
+ barcodeId: 'barcode-' + system.getUuid()
|
|
|
}
|
|
|
},
|
|
|
mounted() {
|
|
|
this.createBarcode(this.config)
|
|
|
- this.$nextTick(() => {
|
|
|
- const barcode = document.getElementById(this.barcodeId);
|
|
|
- barcode.style.width = `${this.style.width}px`;
|
|
|
- barcode.style.height = `${this.style.height}px`;
|
|
|
- })
|
|
|
},
|
|
|
computed: {
|
|
|
computeStyle() {
|
|
@@ -45,10 +41,13 @@ export default {
|
|
|
},
|
|
|
methods: {
|
|
|
createBarcode(config) {
|
|
|
+ this.$nextTick(() => {
|
|
|
+ const barcode = document.getElementById(this.barcodeId);
|
|
|
+ barcode.style.width = `${this.style.width}px`;
|
|
|
+ barcode.style.height = `${this.style.height}px`;
|
|
|
+ })
|
|
|
const barcode = document.getElementById(this.barcodeId);
|
|
|
- JsBarcode(barcode, this.value, {
|
|
|
- ...config,
|
|
|
- });
|
|
|
+ JsBarcode(barcode, this.value, {...config});
|
|
|
}
|
|
|
},
|
|
|
watch: {
|
|
@@ -61,7 +60,3 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
</script>
|
|
|
-
|
|
|
-<style scoped lang="less">
|
|
|
-
|
|
|
-</style>
|