#
whycq
2022-02-26 5df158f54eb0c7e0e0ba79eb172aaba42735a221
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-td" :style="{ 'border-width': thBorder + 'px','border-color':borderColor ,'font-size':fontSize+'px' ,'color':color,'justify-content':tdAlignCpd}">
        <slot></slot>
    </view>
</template>
 
<script>
    export default {
        props: {
            align: String
        },
        data() {
            return {
                thBorder: '1',
                borderColor: '#d0dee5',
                fontSize: '14',
                color: '#555c60',
                tdAlign: '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.tdAlign = this.align;
            } else {
                this.tdAlign = this.tr.align
            }
        },
        computed: {
            tdAlignCpd() {
                let nameAlign = '';
                switch (this.tdAlign) {
                    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-td {
        flex: 1;
        display: flex;
        align-items: center;
        width: 100%;
        padding: 14upx;
        border-top: 1px #d0dee5 solid;
        border-left: 1px #d0dee5 solid;
        text-align: center;
        color: #555c60;
        font-size: 28upx;
 
    }
</style>