Commit 5a84e083 by 胡悦

修复命中文本样式

1 parent 1979b544
......@@ -24,11 +24,17 @@
{{ scope.row.score }}/{{ scope.row.sumScore }}
</template>
</el-table-column>
<el-table-column prop="scriptRec" label="命中文本" align="center">
<el-table-column prop="processedScriptRec" label="命中文本" align="center">
<template slot-scope="scope">
<el-tooltip :content="scope.row.processedScriptRec" placement="top" effect="light">
<div class="text-ellipsis">{{ scope.row.processedScriptRec }}</div>
</el-tooltip>
<template v-if="scope.row.processedScriptRec">
<el-tooltip placement="top" effect="light">
<div slot="content" v-html="scope.row.processedScriptRec"></div>
<div class="text-ellipsis" v-html="scope.row.processedScriptRec"></div>
</el-tooltip>
</template>
<template v-else>
<div class="text-ellipsis">暂无命中文本</div>
</template>
</template>
</el-table-column>
</el-table>
......@@ -50,10 +56,20 @@ export default {
},
computed: {
processedQualityList() {
return this.qualityData.map(item => ({
...item,
processedScriptRec: item.scriptRec?.replace(/[\[\]"]/g, '') || ''
}))
return this.qualityData.map(item => {
let hitTextArr = ''
try {
hitTextArr = JSON.parse(item.hitText);
} catch (e) {
hitTextArr = '';
}
return {
...item,
processedScriptRec: (hitTextArr && hitTextArr.length)
? hitTextArr.map(text => text.replace(/\n/g, '<br>')).join('')
: ''
}
})
}
},
mounted() {
......@@ -114,4 +130,13 @@ export default {
}
}
}
.text-ellipsis {
text-align: left;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
/* 定义文本的行数 */
overflow: hidden;
text-overflow: ellipsis;
}
</style>
\ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!