diff --git a/public/index.html b/public/index.html index afdd596..9d8208a 100644 --- a/public/index.html +++ b/public/index.html @@ -17,7 +17,7 @@ width: 100%; height: 100%; padding: 10pt 10pt; - border: 1pt solid #000; + border: 2pt solid #000; } .temuBarCode-code { @@ -30,11 +30,11 @@ display: flex; align-items: center; justify-content: space-between; - width: 90%; + width: 93%; } .temuBarCode-middle { - width: 80%; + width: 85%; height: 60%; } diff --git a/src/components/print/Print.vue b/src/components/print/Print.vue index 3b63a5d..bb96a10 100644 --- a/src/components/print/Print.vue +++ b/src/components/print/Print.vue @@ -274,8 +274,6 @@ return '' } } - - const list = this.labels this.hiprintTemplate.print(printData) }, @@ -284,23 +282,20 @@ node.innerHTML = el.html() document.querySelector('body').appendChild(node) - return node.innerHTML + const html = node.innerHTML + + document.querySelector('body').removeChild(node) + return html }, savePdf() { - const list = this.labels this.hiprintTemplate.toPdf(printData, '测试导出pdf').then(v => { console.log(v) }) }, getHtml() { - const list = this.labels - console.log(printData) this.html = this.elementToString(this.hiprintTemplate.getHtml(printData)) - - console.log(this.html) - this.isShowPreview = true }, diff --git a/src/components/print/customProvider.js b/src/components/print/customProvider.js index 3c061dd..55dd1b8 100644 --- a/src/components/print/customProvider.js +++ b/src/components/print/customProvider.js @@ -12,20 +12,26 @@ export const customProvider = function (options) { formatter: function (title, options, templateData) { console.log(options, templateData) var elId = 'barCode-' + new Date().getTime() - $('body').append('') + // eslint-disable-next-line no-undef + $('body').append('') - console.log(options.width * 0.8) + // eslint-disable-next-line no-undef JsBarcode('#'+ elId, '96778555251', { - format: "CODE128", + format: "CODE128B", width: 2, - height: options.height * 0.6, + height: options.height * 0.6 + 4, margin: 0, displayValue: false }) + // eslint-disable-next-line no-undef const codeHtml = $(`#${elId}`).html() + // eslint-disable-next-line no-undef $(`#${elId}`).remove() - + // eslint-disable-next-line no-undef + $('document').on('resize', `#${elId}`, e => { + console.log(e) + }); var html = `
@@ -34,7 +40,7 @@ export const customProvider = function (options) {
- + ${codeHtml}