调样式

This commit is contained in:
yanran200730
2024-10-21 21:56:34 +08:00
parent 441510a4e4
commit d9fe8dea7b
3 changed files with 19 additions and 18 deletions

View File

@@ -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('<svg id="' + elId + '" width="100%" display="block" height="100%" class="hibarcode_imgcode" preserveAspectRatio="none slice"></svg>')
// eslint-disable-next-line no-undef
$('body').append('<svg id="' + elId + '"></svg>')
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 = `
<div class="temuBarCode">
<div class="temuBarCode-top">
@@ -34,7 +40,7 @@ export const customProvider = function (options) {
</div>
<div class="temuBarCode-middle">
<div class="hiprint-printElement-text-content hiprint-printElement-content temuBarCode-code">
<svg id="${elId}" style="display: block; width="100%" display="block" height="100%" class="hibarcode_imgcode" preserveAspectRatio="none slice">
<svg id="${elId}" style="display: block" width="100%" display="block" height="100%" class="hibarcode_imgcode" preserveAspectRatio="none slice">
${codeHtml}
</svg>
</div>