#
whycq
2023-04-27 8e793ad7973359bc44fb4e691bbf1008940f9af7
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
<template>
    <view>
        <view class="print-model" :style="style">
            <view class="display" :style="">
                <table >
                    <tr><td>料号</td><td>{{mat.matnr}}</td><td colspan="1" rowspan="2" style="width: 150px;"></td></tr>
                    <tr><td>商品</td><td colspan="1">{{mat.matkx}}</td></tr>
                    <tr><td>日期</td><td colspan="2">2023-04-24 15:25:32</td></tr>
                </table>
            </view>
        </view>
    </view>
</template>
 
<script>
    export default {
        data() {
            return {
                style: {height:'3px'},
                mat: {matnr: '1200128-10055',matkx: 'X5S-4-M03/333'}
            }
        },
        onShow() {
            let getWindowInfo = uni.getWindowInfo()
            console.log(getWindowInfo.screenHeight); //屏幕高度
            console.log(getWindowInfo.screenWidth); //屏幕宽度
            console.log(getWindowInfo.windowHeight); //可操作页面高度
            console.log(getWindowInfo.windowWidth); //可操作页面宽度
            console.log(getWindowInfo);
            console.log('获取窗口信息');
            let height = (getWindowInfo.screenWidth + 10 ) * 48 / 74
            console.log(height);
            this.style.height = height + 'px'
            
        }
    }
</script>
 
<style>
    .print-model {
        width: 100%;
        /* background-color: #555555; */
        display: flex;
        align-items: center;
        justify-content: center;
    }
    .display {
        width: 96%;
        height: 96%;
        border-radius: 5px;
        background-color: #FFF;
        box-shadow: #bdbdbd;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    .display-pak {
        margin: 2%;
        height: 92%;
        border: 1px solid #8a8a8a;
    }
    table {
        width: 92%;
        height: 92%;
        border: 0;
        border-collapse: collapse;
    }
    td {
        border: 1px solid #8a8a8a;
        text-align: center;
    }
</style>