Skip to content

Commit

Permalink
fix: 修复新添加的条形码/二维码元素-左右对齐参数不生效的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
george-hong authored and Xavier9896 committed Mar 5, 2024
1 parent 3d570b5 commit 72141cb
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/hiprint/hiprint.bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -2395,7 +2395,7 @@ var hiprint = function (t) {

return null;
}, t.prototype.createTarget = function () {
return this.target = $(`<div class="hiprint-option-item">\n <div class="hiprint-option-item-label">\n ${i18n.__('左右对齐')}\n </div>\n <div class="hiprint-option-item-field">\n <select class="auto-submit">\n <option value="" >${i18n.__('默认')}</option>\n <option value="" >${i18n.__('居左')}</option>\n <option value="center" >${i18n.__('居中')}</option>\n <option value="right" >${i18n.__('居右')}</option>\n <option value="justify" >${i18n.__('两端对齐')}</option>\n </select>\n </div>\n </div>`), this.target;
return this.target = $(`<div class="hiprint-option-item">\n <div class="hiprint-option-item-label">\n ${i18n.__('左右对齐')}\n </div>\n <div class="hiprint-option-item-field">\n <select class="auto-submit">\n <option value="" >${i18n.__('默认')}</option>\n <option value="left" >${i18n.__('居左')}</option>\n <option value="center" >${i18n.__('居中')}</option>\n <option value="right" >${i18n.__('居右')}</option>\n <option value="justify" >${i18n.__('两端对齐')}</option>\n </select>\n </div>\n </div>`), this.target;
}, t.prototype.getValue = function () {
var t = this.target.find("select").val();
if (t) return t.toString();
Expand Down Expand Up @@ -9179,7 +9179,11 @@ var hiprint = function (t) {
})
content.html($(barcode))
if (!this.options.hideTitle) {
content.append($(`<div class="hiprint-printElement-barcode-content-title" style="text-align: center">${ title ? title + ( text ? ":" : '' ) : "" }${ text }</div>`))
const titleText = title ? title + ( text ? ':' : '' ) : '';
const textAlign = this.options.textAlign || 'center';
// 支持type为barcode的textAlign属性
const textStyle = textAlign === 'justify' ? 'text-align-last: justify;text-justify: distribute-all-lines;' : `text-align: ${ textAlign };`
content.append($(`<div class="hiprint-printElement-barcode-content-title" style="${ textStyle }">${ titleText }${ text }</div>`))
}
} catch (error) {
console.error(error)
Expand Down Expand Up @@ -9244,7 +9248,11 @@ var hiprint = function (t) {
})
content.html($(qrcode))
if (!this.options.hideTitle) {
content.append($(`<div class="hiprint-printElement-qrcode-content-title" style="text-align: center">${ title ? title + ( text ? ":" : '' ) : "" }${ text }</div>`))
const titleText = title ? title + ( text ? ':' : '' ) : '';
const textAlign = this.options.textAlign || 'center';
// 支持type为qrcode的textAlign属性
const textStyle = textAlign === 'justify' ? 'text-align-last: justify;text-justify: distribute-all-lines;' : `text-align: ${ textAlign };`
content.append($(`<div class="hiprint-printElement-qrcode-content-title" style="${ textStyle }">${ titleText }${ text }</div>`))
}
} catch (error) {
console.error(error)
Expand Down

0 comments on commit 72141cb

Please sign in to comment.