<div v-if="detail" v-html="detail" class="html-box"/>
第一种方法:利用正则表达式,对DOM元素替换
if (this.detail) {
this.detail = this.detail.replace(/<img/gi, '<img style="width: 100%;height:auto;"')
this.detail = this.detail.replace(/<p/gi, '<p style="line-height: 150%;"')
}
第二种方法,也是推荐的方法:
<style lang="less">
.html-box{
/deep/ p{
line-height: 150%;
}
/deep/ img{
width: 100%;
height:auto;
}
}
</style>
最后
以上就是生动鞋垫最近收集整理的关于电脑端编辑富文本在手机端展示样式有问题的全部内容,更多相关电脑端编辑富文本在手机端展示样式有问题内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复