小程序rich-text单行省略
返回数据为HTML字符串,需要在rich-text渲染, 需要在一行显示,超出部分进行隐藏
template片段
<rich-text :nodes="formatRich(item.examName || '')"></rich-text>
script方法
formatRich(val) {
return "<div style='overflow: hidden;text-overflow: ellipsis;white-space: nowrap;'>" + val + "</div>"
},
通过以上方法即可解决
参考文档:https://blog.csdn.net/u013611033/article/details/121535633