eight
2024-12-02 a90276a242ddca6f45e234c5cc4832a7a01a7e03
src/components/Barcode/src/Barcode.vue
@@ -6,7 +6,7 @@
<script lang="ts" setup>
import { ref, onMounted, nextTick } from 'vue'
import { ref, onMounted, watch, nextTick } from 'vue'
import JsBarcode from 'jsbarcode'
defineOptions({ name: 'Barcode' })
@@ -17,8 +17,7 @@
  value: String
});
onMounted(() => {
  nextTick(() => {
const generateBarcode = () => {
    JsBarcode('.barcode', String(props.value), {
      format: "CODE39",//选择要使用的条形码类型
      width:1,//设置条之间的宽度
@@ -35,8 +34,14 @@
//   lineColor:"#2196f3",//设置条和文本的颜色。
      margin:15//设置条形码周围的空白边距
    });
}
onMounted(() => {
  nextTick(() => generateBarcode())
  })
})
watch(() => props.value, generateBarcode);
</script>
<style lang="scss" scoped>