PhoneDialog.vue
2.66 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
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
<script>
export default {
components: {},
props: {
message: {
type: String,
default: '',
},
isOther: {
type: Boolean,
default: false,
},
imageList: {
type: Array,
default: () => [],
},
messageList: {
type: Array,
default: () => [],
},
},
data() {
return {}
},
watch: {},
computed: {},
created() {},
mounted() {},
methods: {},
}
</script>
<template>
<PhoneTemplate>
<div class="time">13:14</div>
<ul class="msg-ul">
<li class="flex msg-li">
<div class="avatar fxnone">
<svg-icon icon="user" />
</div>
<div class="msg">{{ message }}</div>
</li>
<li class="flex msg-li" v-if="isOther">
<div class="avatar fxnone">
<svg-icon icon="user" />
</div>
<div class="msg" style="line-height: 0; padding: 5px">
<slot></slot>
</div>
</li>
<li class="flex msg-li" v-for="message in messageList" :key="message">
<div class="avatar fxnone">
<svg-icon icon="user" />
</div>
<div class="msg">
<slot name="text" v-bind:text="message"></slot>
</div>
</li>
<li class="flex msg-li" v-for="image in imageList" :key="image">
<div class="avatar fxnone">
<svg-icon icon="user" />
</div>
<div class="msg" style="line-height: 0; padding: 5px">
<slot name="image" v-bind:image="image"></slot>
</div>
</li>
</ul>
</PhoneTemplate>
</template>
<style lang="scss" scoped>
.time {
font-size: 12px;
color: var(--font-black-7);
padding: 10px 0 5px;
text-align: center;
}
.msg-ul {
margin: 0;
padding: 0;
max-height: 80%;
overflow: auto;
padding: 0 10px;
}
.msg-li {
margin-bottom: 10px;
}
.msg {
min-height: 28px;
background: var(--bg-white);
border: 1px solid var(--border-black-9);
display: inline-block;
position: relative;
text-align: left;
font-size: 14px;
line-height: 22px;
padding: 3px 6px;
border-radius: 4px;
max-width: 90%;
min-width: 24px;
box-sizing: border-box;
word-break: break-all;
white-space: pre-line;
margin-left: 10px;
&:before {
content: ' ';
display: block;
position: absolute;
left: -6px;
border-width: 4px 6px;
border-left: 0;
width: 0;
border-style: solid;
border-color: transparent;
border-right-color: var(--border-white);
top: 10px;
z-index: 888;
}
}
.avatar {
border: 1px solid var(--border-white);
background: var(--bg-white);
border-radius: 6px;
width: 28px;
height: 28px;
display: flex;
align-items: center;
justify-content: center;
}
</style>