whycq
2022-03-09 a27ddbef869c993682355a6aed02b5f6a0c0b84a
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
<template>
    <view class="t-th" :style="{ 'border-width': thBorder + 'px' ,'border-color':borderColor,'font-size':fontSize+'px' ,'color':color,'justify-content':thAlignCpd}">
        <slot></slot>
    </view>
</template>
 
<script>
    export default {
        props: {
            align: String,
        },
        data() {
            return {
                thBorder: '1',
                borderColor: '#d0dee5',
                fontSize: '15',
                color: '#3b4246',
                thAlign: 'center'
            };
        },
        inject: ['table', 'tr'],
 
        created() {
            this.thBorder = this.table.border;
            this.borderColor = this.table.borderColor;
            this.fontSize = this.tr.fontSize;
            this.color = this.tr.color;
            if (this.align) {
                this.thAlign = this.align;
            } else {
                this.thAlign = this.tr.align
            }
        },
 
        computed: {
            thAlignCpd() {
                let nameAlign = '';
                switch (this.thAlign) {
                    case 'left':
                        nameAlign = 'flex-start'
                        break;
                    case 'center':
                        nameAlign = 'center'
                        break;
                    case 'right':
                        nameAlign = 'flex-end'
                        break;
                    default:
                        nameAlign = 'center'
                        break;
                }
                return nameAlign
            }
        }
    };
</script>
 
<style>
    .t-th {
        flex: 1;
        display: flex;
        align-items: center;
        font-size: 30upx;
        font-weight: bold;
        text-align: center;
        color: #3b4246;
        border-left: 1px #d0dee5 solid;
        border-top: 1px #d0dee5 solid;
        padding: 15upx;
    }
</style>