所以这是我的组件代码:
<template>
<div id="something" class="card">
</div>
</template>
const height = 200;
const width = 200;
let graph = d3
.select('#something')
.append('svg')
.attr('class', 'chart-container')
.attr('height', height)
.attr('width', width);
<style lang="scss" scoped>
.chart-container {
background-color: aquamarine;
}
</style>
SVG具有应用于
.chart-container
的类,但没有应用样式。
然而,当我从<style lang="scss">
中移除scoped
时,它可以正常工作。
为什么它会表现出那种方式?