Skip to content

Commit

Permalink
style: 修复barcode的样式
Browse files Browse the repository at this point in the history
  • Loading branch information
ROYIANS committed Oct 23, 2023
1 parent 858e338 commit 83b4fd1
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
14 changes: 13 additions & 1 deletion src/components/PageComponents/RoyBarCode.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<template>
<div class="RoyBarCode">
<StyledBarCode v-bind="style">
<div style="width: 100%; height: 100%" ref="barCode" />
<div :style="barStyle" ref="barCode" />
<div v-if="element.includeText" class="RoyBarCode__text" :style="textStyle">
{{ element.text }}
</div>
Expand Down Expand Up @@ -43,6 +43,18 @@ export default {
style() {
return this.element.style || {}
},
barStyle() {
if (this.element.includeText) {
return {
width: '100%',
height: 'calc(100% - 14px)'
}
}
return {
width: '100%',
height: '100%'
}
},
textStyle() {
return {
color: this.element.colorDark,
Expand Down
2 changes: 1 addition & 1 deletion src/components/Viewer/page-generator.js
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ class BasePageGenerator {
img.src = component.propValue
img.alt = component.text
img.style.width = '100%'
img.style.height = '100%'
img.style.height = includeText ? 'calc(100% - 14px)' : '100%'
newElement.appendChild(img)
if (includeText) {
let text = document.createElement('div')
Expand Down

0 comments on commit 83b4fd1

Please sign in to comment.