参考文档bash
经过 PostCSS 实现如下转换dom
<style scoped>
.example {
color: red;
}
</style>
<template>
<div class="example">hi</div>
</template>
复制代码
转换结果:spa
<style>
.example[data-v-f3f3eg9] {
color: red;
}
</style>
<template>
<div class="example" data-v-f3f3eg9>hi</div>
</template>
复制代码
<style>
/* 无做用域样式 */
</style>
<style scoped>
/* 有做用域样式 */
</style>
复制代码
<style scoped>
.a >>> .b { /* ... */ }
</style>
编译后
.a[data-v-f3f3eg9] .b { /* ... */ }
复制代码