问题:
在 js 中通过 .innerHTML 添加元素到页面中
元素可以渲染到页面中,并且控制台中可以看到 class ,但样式不生效
解决方法:
使用样式穿透进行修改样式
<style lang="less" scoped>
::v-deep .goalDotBtn {
background: none;
color: #551A8B;
width: 80px;
height: 34px;
border: 0;
margin: 0 10px;
}
::v-deep .goalDotBtn:hover {
background-color: #EBE4F1;
}
</style>