Configureable barcode format via bwp-js
This commit is contained in:
@@ -331,11 +331,22 @@
|
||||
import { reactive } from "vue";
|
||||
import { TYPE, useToast } from "vue-toastification";
|
||||
import axios from "redaxios";
|
||||
import JsBarcode from "jsbarcode";
|
||||
import bwipjs from "bwip-js";
|
||||
|
||||
function textToBase64Barcode(text){
|
||||
var canvas = document.createElement("canvas");
|
||||
JsBarcode(canvas, text, {format: "CODE128", displayValue:false});
|
||||
bwipjs.toCanvas(canvas,
|
||||
{
|
||||
bcid: config.codeformat,
|
||||
text: text,
|
||||
scale: 4,
|
||||
height: 10,
|
||||
// width: 10,
|
||||
includetext: true,
|
||||
textxalign: 'center',
|
||||
backgroundcolor: 'ffffff'
|
||||
}
|
||||
)
|
||||
return canvas.toDataURL("image/png");
|
||||
}
|
||||
|
||||
@@ -353,6 +364,7 @@ const state = reactive({
|
||||
delete_active: false,
|
||||
fullobject: {}
|
||||
})
|
||||
state.barcode = textToBase64Barcode("12345");
|
||||
const toast = useToast();
|
||||
const props = defineProps({
|
||||
token: String
|
||||
|
||||
Reference in New Issue
Block a user