后端很多时候直接返回后台上传的富文本内容,内容的图片在小程序会超出,样式乱的
找了很多办法,发现此方法可用,记录下
wxml
添加固定容器类名位:ql-container
和 ql-deitor
即可限制内部内容的样式
<view class="ql-container">
<view class="ql-deitor">
<rich-text class="" nodes="{{nodes}}"></rich-text>
</view>
</view>
wxss
.ql-container {
display: block;
position: relative;
box-sizing: border-box;
-webkit-user-select: text;
user-select: text;
outline: none;
overflow: hidden;
width: 100%;
height: auto;
margin-bottom: 30rpx;
min-height: 50px !important;
}