使用:
<ouyang />
ouyang.vue 代码:
<template>
<view class="ouyang">
123
<xinghua />
</view>
</template>
<script>
import xinghua from './xinghua.vue'
export default {
name: 'ouyang',
options: {
styleIsolation: 'shared'
},
components: {
xinghua
}
}
</script>
<style lang="scss" scoped>
.ouyang {
color: red;
::v-deep {
.xinghua {
color: red;
}
}
}
</style>
<template>
<view class="xinghua">
456
</view>
</template>
<script>
export default {
name: 'xinghua'
}
</script>
<style lang="scss" scoped>
.xinghua {
color: green;
}
</style>
::v-deep {
.xinghua {
color: red;
}
}
这里的代码并没有生效,而我在打包后的json里面加上 "styleIsolation": "shared" 就能生效了