vue2-样式冲突-使用deep修改子组件中的样式

/deep/样式穿透

<template>
    <div class="left-container">
        <h3>Left 组件</h3>
        <my-count :init="9"></my-count>
    </div>
</template>

<script>
export default {}
</script>

<style lang="less" scoped>
.left-container {
  padding: 0 20px 20px;
  background-color: orange;
  min-height: 250px;
  flex: 1;
}

h3 {
  color: red;
}

// 当使用第三方组件库的时候,如果有修改组件默认样式的需求,需要用到 /deep/
/deep/ h5 {
  color: pink;
}
</style>

posted @ 2023-07-04 23:41  Young_Yang_Yang  阅读(580)  评论(0编辑  收藏  举报