v-html注入的html内容,写的样式不生效
解决方法: 去掉scoped,使用全局样式
<div v-html="srcList" class="chartBox">
<style lang="scss">
.chartBox {
overflow: auto;
}
.chartBox svg {
width: 100%;
/* 或者你想要的具体宽度,例如 200px */
height: auto;
/* 保持纵横比 */
}
</style>
<div v-html="srcList" class="chartBox">
<style lang="scss">
.chartBox {
overflow: auto;
}
.chartBox svg {
width: 100%;
/* 或者你想要的具体宽度,例如 200px */
height: auto;
/* 保持纵横比 */
}
</style>