v-html渲染富文本图片宽高问题

v-html渲染富文本
v-html是用来渲染html的节点及字符串的,但是渲染后富文本里的图片宽高会溢出所在div的区域
但是使用css直接给img是没有办法设置img的宽高的,需要使用深层级来给img设置宽高
具体代码如下:

<div class="cont" v-html="cont"></div>

.cont >>> img{
width:100%;
height:200px;
}


posted @ 2020-07-22 14:07  haruhae  阅读(3157)  评论(0)    收藏  举报