vue-barcode使用记录

一、vue-barcode 是JsBarcode的简单包装

二、有俩版本!(还有这种操作??)

版本一:https://github.com/lindell/vue-barcode
-通过 npm install vue-barcode安装
版本二:https://github.com/xkeshi/vue-barcode
-通过npm install @xkeshi/vue-barcode 安装

三、上面两个版本区别

版本一:只能单独绑定属性(反正我直接绑定options没效果(╬◣д◢))

<barcode :value="barcodeValue"
                 :width="7"
                 :height="200">

版本二:可直接options绑定所有属性

<barcode :value="barcodeValue"
                 :options="{ width:100 ,height:100}">

四、具体使用

github里都有!
①install
②import VueBarcode from ‘vue-barcode’;(版本一)
import VueBarcode from ‘@xkeshi/vue-barcode’;(版本二)

new Vue({
  components: {
    'barcode': VueBarcode
  }
})

`<barcode :value="barcodeValue">
    条形码显示失败时的内容
</barcode>`

④可绑定的属性值去JsBarcode官方文档查看
https://github.com/lindell/JsBarcode

五、我还是选版本一吧!


版权声明:本文为liulilili_dans原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。