<!--temp是一组p标签-->
<div class="lyric-container" v-html="temp"></div>
 
<style lang="scss" scoped>
.lyric-container{
    position: absolute;
    top: 0;
    left: 0;
    padding-top: 1.25rem;

    p {//这个规则不会应用
        font-size: 0.16rem;
        color: rgb(170, 170, 170);
    }
}
</style>


以前遇到过一样的问题,动态生成的元素没有样式,后面用了个暴力的方法解决,写了两个style标签。

 
<style lang="scss" scoped>
//这里是页面本来有的
</style>

<style lang="scss">
//这里写动态生成的
</style>


尝试去掉style 中 scoped属性后,问题解决

有兄弟在sf中这样解释

vue(v-html)和scss的使用问题

相关文章:

  • 2022-12-23
  • 2022-02-05
  • 2022-12-23
  • 2021-09-04
  • 2022-12-23
  • 2022-12-23
  • 2021-05-28
  • 2022-12-23
猜你喜欢
  • 2021-11-21
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-01
  • 2022-12-23
相关资源
相似解决方案