因为 rich-text 里面有不少图片, u-read-more
计算高度后图片才加载出来, 高度就会不对.
解决方法就是, 在图片加载好后, 再调用一次 this.$refs.uReadMore.init();
但 uni-app 的 rich-text
没有提供图片加载完成的事件. uView 有个 u-parse
富文本组件, 但加载出来的样式有问题.
只能从 u-read-more
组件下手.
方法是在 u-read-more
组件 toggleReadMore()
中再获取一次高度
node_modules/uview-ui/components/u-read-more/u-read-more.vue
获取高度
this.getContentHeight().then(height => {
this.contentHeight = height
})