scoped 样式中的 deep
<template>
<div class="home">
<HelloWorld />
</div>
</template>
<style scoped>
</style><template>
<div class="hello">
hello
<div class="world">
world
</div>
</div>
</template>Last updated
<template>
<div class="home">
<HelloWorld />
</div>
</template>
<style scoped>
</style><template>
<div class="hello">
hello
<div class="world">
world
</div>
</div>
</template>Last updated
<style scoped>
.home .world {
color: red;
}
</style><style scoped>
.home .hello {
color: red;
}
</style>// 方式1,兼容 scss
<style scoped>
.home /deep/ .world {
color: red;
}
</style>
// 方式二
<style scoped>
.home ::v-deep .world {
color: red;
}
</style>
// 方式三 不能用于 scss 中
<style scoped>
.home >>> .world {
color: red;
}
</style>