用v-html渲染页面的时候 css样式无效

时间:2018-08-08 17:40:21   收藏:0   阅读:2182

当我们用v-html渲染页面的时候会发现样式并没有添加上,如下

1 <template>
2      <div >
3          <div v-html="some_html" class="box" ></div> 
4 </div>
5 </template>
6 <style scoped>
7 .box p{ color: red; }
8 </style>

解决办法:在写样式的时候添加   >>>   如下所示

1 .box  >>> p { color: red; }

 

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!