更正前端内容
This commit is contained in:
@@ -2,8 +2,18 @@
|
||||
<div class="label-render-container">
|
||||
<!-- 标签预览容器 -->
|
||||
<div class="preview-container" id="label-preview-container" ref="labelRef">
|
||||
<ProductionTagPreview v-if="labelType === '2'" :content="content" />
|
||||
<OuterTagPreview v-if="labelType === '3'" :content="content" />
|
||||
<ProductionTagPreview
|
||||
v-if="labelType === '2'"
|
||||
:content="content"
|
||||
:paperWidthMm="100"
|
||||
:paperHeightMm="80"
|
||||
/>
|
||||
<OuterTagPreview
|
||||
v-if="labelType === '3'"
|
||||
:content="content"
|
||||
:paperWidthMm="180"
|
||||
:paperHeightMm="100"
|
||||
/>
|
||||
<SampleTagPreview v-if="labelType === '4'" :content="content" />
|
||||
<ForgeTagPreview v-if="labelType === '5'" :content="content" />
|
||||
<SaltSprayTagPreview v-if="labelType === '6'" :content="content" />
|
||||
@@ -90,14 +100,16 @@ export default {
|
||||
await this.waitForAllResources(labelContainer);
|
||||
|
||||
// 3. 计算纸张尺寸和缩放比例
|
||||
// 纸张尺寸:180mm x 100mm
|
||||
// 1mm ≈ 3.779527559px (96 DPI)
|
||||
const paperWidthMm = 180;
|
||||
const paperHeightMm = 100;
|
||||
// 根据标签类型设置纸张尺寸:
|
||||
// 产品码:100mm x 180mm(横向,原先180x100)
|
||||
// 原料码:80mm x 100mm(竖向)
|
||||
const isMaterial = labelContainer.classList.contains('material-label-container');
|
||||
const paperWidthMm = isMaterial ? 100 : 180;
|
||||
const paperHeightMm = isMaterial ? 80 : 100;
|
||||
const dpi = 96;
|
||||
const mmToPx = dpi / 25.4;
|
||||
const paperWidthPx = paperWidthMm * mmToPx; // 约 680.3px
|
||||
const paperHeightPx = paperHeightMm * mmToPx; // 约 377.95px
|
||||
const paperWidthPx = paperWidthMm * mmToPx;
|
||||
const paperHeightPx = paperHeightMm * mmToPx;
|
||||
|
||||
// 获取标签容器的实际尺寸
|
||||
const containerRect = labelContainer.getBoundingClientRect();
|
||||
|
||||
Reference in New Issue
Block a user