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
<!-- 表格信息界面 -->
<template>
<div class="tb-info displaydata">
<div class="ValueCls" v-for="(value, key, index) of keyValue" :key="index">
<div class="keyValueCls">{{ value }}:</div>
<div class="dataInfoCls">{{ data[key] }}</div>
</div>
</div>
</template>
<script>
export default {
name: 'TableSingleView',
props: {
title: String,
keyValue: Object,
data: Object,
faIndex: {
type: Number,
default: 0
}
},
data() {
return {
maxWidth: document.body.clientWidth * 0.9 * 0.6,
lineWidth: document.body.clientWidth * 0.9,
flowerFlag: false
};
},
methods: {
//是否按文本域展示
getNewline(value) {
if (!value) return false;
var chValue = value.match(/[\u4e00-\u9fa5]/g) ? value.match(/[\u4e00-\u9fa5]/g).join('') : '',
onlineWidth = chValue.length * 14 + (value.length - chValue.length) * 7;
return onlineWidth > this.maxWidth ? true : false;
},
//文本域是否超出展示区域
getNewHeight(value) {
if (!value) return false;
var chValue = value.match(/[\u4e00-\u9fa5]/g) ? value.match(/[\u4e00-\u9fa5]/g).join('') : '',
onlineWidth = chValue.length * 14 + (value.length - chValue.length) * 7;
return onlineWidth / this.lineWidth > 2 ? true : false;
}
}
};
</script>
<style scoped lang="scss">
.displaydata {
width: 100%;
height: auto;
}
.ValueCls {
padding: 8px 0;
display: grid;
grid-template-columns: 1fr 3fr;
}
.keyValueCls {
width: 100%;
color: #999999;
text-align: right;
font-size: 16px;
white-space: nowrap;
}
.dataInfoCls {
width: 100%;
color: #333333;
text-align: left;
font-size: 16px;
word-break: break-all;
}
</style>