Skip to content
This repository was archived by the owner on Mar 26, 2023. It is now read-only.

Commit 38a31b9

Browse files
committed
fixed text overflow
1 parent 07385c6 commit 38a31b9

1 file changed

Lines changed: 33 additions & 17 deletions

File tree

src/components/EventRow.vue

Lines changed: 33 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,24 +7,15 @@
77
<div>
88
<b>{{lesson.name}}</b>
99
</div>
10-
<div>
11-
<span
12-
v-for="info in lesson.lecturer" :key="info.id" :info="info"
13-
>
14-
{{formatLecturer(info)}}&ensp;
15-
</span>
16-
<span v-if="lesson.lecturer && lesson.room"> &bull;&ensp;
17-
</span>
18-
<span
19-
v-for="info in lesson.room" :key="info.id" :info="info"
20-
>
21-
{{info.name}}&ensp;
10+
<div class="extra">
11+
<span v-html="this.formatInfo(lesson.lecturer, lesson.room)">
2212
</span>
2313
</div>
2414
</div>
2515
</li>
2616
</template>
2717
<script>
18+
2819
export default{
2920
props:{
3021
lesson:{
@@ -35,8 +26,22 @@ export default{
3526
methods:{
3627
formatLecturer(info){
3728
if (!info.middle_name)
38-
return `${info.last_name} ${info.first_name[0]}.`;
39-
return `${info.last_name} ${info.first_name[0]}.${info.middle_name[0]}.`;
29+
return `${info.last_name} ${info.first_name[0]}. `;
30+
return `${info.last_name} ${info.first_name[0]}.${info.middle_name[0]}. `;
31+
},
32+
formatInfo(lecturer, room){
33+
let total = '';
34+
35+
room.forEach(element => {
36+
total += `${element.name} `
37+
})
38+
if (lecturer.length && room.length)
39+
total += `&bull;&ensp;`;
40+
lecturer.forEach(element => {
41+
total += `${this.formatLecturer(element)}`;
42+
});
43+
44+
return total;
4045
}
4146
}
4247
}
@@ -71,16 +76,27 @@ export default{
7176
padding-left: 10px;
7277
7378
}
74-
79+
div.extra{
80+
display: flex;
81+
gap:5%;
82+
width: 90%;
83+
}
84+
span{
85+
overflow: hidden;
86+
white-space: nowrap;
87+
text-overflow: ellipsis;
88+
flex-wrap: nowrap;
89+
text-align: center;
90+
}
7591
.info{
7692
display: flex;
7793
flex-direction: column;
7894
align-items: flex-start;
7995
padding-right: 10px;
8096
gap: 5px;
81-
97+
text-overflow: ellipsis;
8298
/* Inside auto layout */
83-
99+
flex-wrap: nowrap;
84100
flex: 1;
85101
order: 1;
86102
}

0 commit comments

Comments
 (0)