index.vue
2.54 KB
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
<template>
<div>
<template v-if="rowParams.length > 0">
<div class="layout-wrap">
<el-row :gutter="30">
<template v-for="(params, index) in rowParams">
<!-- <template v-if="params.isHidden && params.isHidden(list)">
<el-col :span="params.span" :key="index">
<div class="label-wrap">
<label>{{ params.label }}</label>
<slot v-if="params.addHtml" :name="params.addHtml" :scope="list"></slot>
<span v-else>
{{ list[params.prop] }}
</span>
</div>
</el-col>
</template> -->
<template>
<el-col :span="params.span" :key="index">
<div class="label-wrap">
<label>{{ params.label }}</label>
<slot v-if="params.addHtml" :name="params.addHtml" :scope="list"></slot>
<span v-else>
{{ list[params.prop] }}
</span>
</div>
</el-col>
</template>
</template>
</el-row>
</div>
</template>
</div>
</template>
<script>
export default {
name: 'glsx-rows',
data() {
return {
list: '',
rowParams: ''
}
},
props: {
//获取的数据
layoutData: {
type: Object,
default: () => {}
},
layoutParams: {
type: Array,
default: () => []
}
},
watch: {
layoutData(val) {
this.list = val
let { layoutParams } = this
for (let i = 0; i < layoutParams.length; i++) {
if (layoutParams[i].isHidden && !layoutParams[i].isHidden(val)) {
layoutParams.splice(i--, 1)
}
}
this.rowParams = layoutParams
}
},
created() {}
}
</script>
<style scoped lang="scss">
.layout-wrap {
.el-row {
&:last-child {
margin-bottom: -20px;
}
.el-col {
margin-bottom: 20px;
}
.label-wrap {
display: flex;
align-items: center;
min-width: 80%;
label {
font-size: 14px;
font-weight: 400;
color: #666666;
line-height: 20px;
text-align: right;
min-width: 70px;
display: inline-block;
}
span {
font-size: 14px;
font-weight: 400;
color: #333333;
line-height: 20px;
text-align: left;
// max-width: 228px;
// white-space: nowrap;
// overflow: hidden;
// text-overflow: ellipsis;
// display: inline-block;
}
}
}
}
</style>