码迷,mamicode.com
首页 > Web开发 > 详细

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

时间:2018-08-08 17:40:21      阅读:2182      评论:0      收藏:0      [点我收藏+]

标签:nbsp   temp   code   样式   red   css   color   span   div   

当我们用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; }

 

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

标签:nbsp   temp   code   样式   red   css   color   span   div   

原文地址:https://www.cnblogs.com/niuxiaoxian/p/9443873.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!