This commit is contained in:
daihh
2022-10-22 15:28:16 +08:00
2 changed files with 7 additions and 4 deletions

View File

@@ -1008,7 +1008,6 @@
margin-right: 30px; margin-right: 30px;
margin-bottom: 30px; margin-bottom: 30px;
border-radius: 8px; border-radius: 8px;
background-color: #000000;
.xindex-course-image{ .xindex-course-image{
width: 340px; width: 340px;

View File

@@ -75,7 +75,7 @@
<!--在这一层上加事件--> <!--在这一层上加事件-->
<div class="answer-text"> <div class="answer-text">
<span style="color: #303133" v-html="displayAll(item)"></span> <span style="color: #303133" v-html="displayAll(item)"></span>
<span v-if="item.content.length > 170" @click="changeIsAll(item)">{{ item.isAll ? '收起' : '全文' <span v-if="item.content.length > 170 || item.content.split('\n').length>5" @click="changeIsAll(item)">{{ item.isAll ? '收起' : '全文'
}}</span> }}</span>
</div> </div>
<div class="answer-time"> <div class="answer-time">
@@ -751,12 +751,16 @@ export default {
hideButtons() { hideButtons() {
this.btnsShowRowId = ''; this.btnsShowRowId = '';
}, },
//展示全部 //展示全部
displayAll(item) { displayAll(item) {
let content = ''; let content = '';
content = item.content.replace(/(\n){2,}/,'<br>'); content = item.content.replace(/(\n){2,}/,'<br>');
item.content = content; item.content = content;
if (!item.isAll && item.content.length > 170) { if (!item.isAll && item.content.length > 170 || !item.isAll && item.content.split("\n").length>5) {
if(!item.isAll && item.content.split("\n").length>5){
return item.content.slice(0, 10) + "...";
}
return item.content.slice(0, 170) + "..."; return item.content.slice(0, 170) + "...";
} }
return item.content; return item.content;
@@ -1023,7 +1027,7 @@ export default {
span { span {
color: #409eff; color: #409eff;
cursor: pointer; cursor: pointer;
margin-left: 5px; // margin-left: 5px;
} }
} }