小程序中當rich-text中數據較多時就會出現溢出的現象 如下
此時的頁面效果並不是很理想 我們可以在數據中給個div
<div style="overflow: hidden;white-space: nowrap;text-overflow: ellipsis">55555555555555555555555555555555555</div>
加入 overflow: hidden; white-space: nowrap; text-overflow: ellipsis;三個屬性解決溢出問題
但這不是很好,如果數據從后台來 上面方法就需要變通一下
如下
<rich-text nodes="<div style='overflow:hidden;white-space:nowrap;text-overflow:ellipsis;'>{{html}}</div>" bindtap="tap"></rich-text>
直接在nodes中包一個div給上屬性,這樣的話不管后台傳的是什么,只要溢出都會顯示三個點