<!--文件名helloWorld-->
<template>
<view class="title">
<text>子組件</text>
</view>
</template>
<style scoped lang="less">
.title{
color:blue;
}
<style>
less或sass無法正確解析'>>>',可以使用/deep/园细。
<template>
<view class="content">
<text>父組件</text>
<helloWorld></helloWorld>
</view>
</template>
<style scoped lang="less">
.content{
/deep/ .title{
color:red;
}
}
<style>
使用'>>>'的方法:
<template>
<view class="content">
<text>父組件</text>
<helloWorld></helloWorld>
</view>
</template>
<style scoped>
.content >>> .title{
color:red;
}
<style>