#
whycq
2023-10-06 8e15159256cd131705aff50b2973bdae52ce6b9b
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
<template>
    <view >
        <view class="main">
            <view class="main-left" >
                <view class="main-list" v-for="it in dataList" style="width: 100%;">
                    <view style="flex: 1;padding-left: 8rpx;">{{it.key}}</view>
                    <view>:</view>
                    <view style="flex: 3;padding-left: 8rpx;">{{it.value}}</view>
                </view>
            </view>
            <view class="main-right" @click="goDetail">
                <view class="list-options">
                    <view class="list-number">1</view>
                    <uni-icons class="opt-icon" type="right" size="20" color="#707070"></uni-icons>
                </view>
            </view>
        </view>
    </view>
</template>
 
<script>
    export default {
        name:"z-data-list",
        data() {
            return {
                dataList: [
                    {key: '商品编码',value: 'fbr3242'},
                    {key: '批号',value: '20231006'},
                    {key: '数量',value: '200'},
                    {key: '商品编码',value: 'fbr3242'},
                    {key: '批号',value: '20231006'},
                    {key: '数量',value: '200'}
                ],
                detailList: [],
                dataKey: {}
            };
        },
        methods: {
            goDetail() {
                this.$emit('goDetail');
            }
        },
        created() {
            this.dataList = this.list.detl
        },
        props: {
            list: {
                type: Object,
                default() {
                    return {}
                }
            },
            keyName: {
                type: Object,
                default() {
                    return {}
                }
            }
        }
    }
</script>
<!-- align-items: stretch -->
<!-- 牛逼!!! -->
<!-- 设置align-items为stretch,使子元素填充垂直方向的可用高度,实现高度相等的效果。 -->
<style scoped>
    .main {
        position: relative;
        min-height: 70rpx;
        background-color: #ebe7e6;
        display: flex;
        align-items: stretch;
        margin: 8px 8px 8px 8px;
        border-radius: 16rpx;
    }
    .main-left {
        flex: 7;
        display: flex;
        flex-direction: column;
        padding-top: 8rpx;
        padding-bottom: 8rpx;
    }
    .main-right {
        flex: 1;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    .main-list {
        display: flex;
        align-items: center;
    }
    .list-options {
        display: flex;
        flex-direction: column;
    }
    .list-number {
        position: absolute;
        right: 10px;
        top: 5px;
    }
    .opt-icon {
        display: flex;
    }
</style>