mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/learning-system-portal.git
synced 2025-12-10 19:36:43 +08:00
解决收起展开样式问题
This commit is contained in:
@@ -78,7 +78,7 @@
|
||||
<!--在这一层上加事件-->
|
||||
<div class="answer-text">
|
||||
<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>
|
||||
</div>
|
||||
<div class="answer-time">
|
||||
@@ -755,12 +755,16 @@ export default {
|
||||
hideButtons() {
|
||||
this.btnsShowRowId = '';
|
||||
},
|
||||
|
||||
//展示全部
|
||||
displayAll(item) {
|
||||
let content = '';
|
||||
content = item.content.replace(/(\n){2,}/,'<br>');
|
||||
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;
|
||||
|
||||
Reference in New Issue
Block a user