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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
| <template>
| <view >
| <view class="main">
| <view class="main-left" >
| <view class="main-list" v-for="it in lable" style="width: 100%;">
| <view class="left-key">{{it.label}}</view>
| <view>:</view>
| <view class="left-val">
| <text :class="it.valText">{{fields[it.attribute]}}</text>
| </view>
| </view>
| </view>
| <uni-badge
| class="main-right uni-badge-left-margin"
| :text="index"
| absolute="rightTop"
| size="small"
| type="primary"
| >
| <view style="height: 100%;display: flex;align-items: center;" @click="goDetail">
| <view class="list-options">
| <uni-icons class="opt-icon" type="right" size="20" color="#b9b9b9"></uni-icons>
| </view>
| </view>
| </uni-badge>
| </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: {},
| valText: 'val-text'
| };
| },
| methods: {
| goDetail() {
| this.$emit('goDetail');
| }
| },
| created() {
| // this.dataList = this.list.detl
| },
| props: {
| lable: {
| type: Array,
| default() {
| return {}
| }
| },
| fields: {
| type: Object,
| default() {
| return {}
| }
| },
| keyName: {
| type: Object,
| default() {
| return {}
| }
| },
| index: {
| type: Number,
| default: 2
| }
| }
| }
| </script>
| <!-- align-items: stretch -->
| <!-- 牛逼!!! -->
| <!-- 设置align-items为stretch,使子元素填充垂直方向的可用高度,实现高度相等的效果。 -->
| <style scoped>
| .main {
| position: relative;
| min-height: 35px;
| background-color: #f5f5f5;
| display: flex;
| align-items: stretch;
| margin: 8px 12px 8px 12px;
| border-radius: 8px;
| }
| .main-left {
| flex: 7;
| display: flex;
| flex-direction: column;
| padding-top: 4px;
| padding-bottom: 4px;
| color: #606164;
| font-size: 14px;
| }
| .main-right {
| width: 30px;
| display: flex;
| align-items: center;
| justify-content: center;
| border-left: 1px solid #ffffff;
| }
| .main-right:active {
| background-color: #e3e5e7;
| color: #FFF;
| }
| .main-list {
| display: flex;
| align-items: center;
| margin: 2px 0;
| }
| .list-options {
| display: flex;
| flex-direction: column;
| }
| .list-number {
| position: absolute;
| right: 10px;
| top: 5px;
| }
| .opt-icon {
| display: flex;
| }
| .left-key {
| width: 65px;
| padding-right: 4px;
| text-align: end;
| font-weight: 700;
| }
| .left-val {
| flex: 1;
| padding-left: 4px;
| color: #606266;
| }
| .val-text {
| background-color: #00aeec;
| padding: 2px 4px;
| border-radius: 4px;
| color: #FFF;
| }
| .val-num {
| font-weight: 900;
| color: #d19a66;
| font-size: 16px;
| }
| </style>
|
|