当前位置:网站首页>深度(穿透)选择器 ::v-deep/deep/及 > > >
深度(穿透)选择器 ::v-deep/deep/及 > > >
2022-07-03 01:22:00 【13少啊】
原文:深度(穿透)选择器 ::v-deep /deep/ 及 >>>_俺是老王的博客-CSDN博客_v-deep
在vue项目的开发过程,使用了ElementUI组件样式style使用了scope属性,当想要修改组件样式,发现直接修改不了,需去掉scope属性或者使用深度选择器才能去修改成功。去掉scope又会影响全局样式,针对这种情况,可以使用深度作用选择器(即样式穿透)。本文对深度选择器做一个记录。
1.当项目中使用的css原生样式,需要使用>>>深度选择器来修改,外用第三方组件的样式
<style lang="css" scoped>
.el-button >>> span{
color: '#f00'
}
</style>2.当项目中使用的css扩展语言是less,需要使用/deep/或者::v-deep深度选择器来修改 外用第三方组件的样式。
<style lang="less" scoped>
/deep/.el-button{
span{
color: '#f00'
}
}
.el-button::v-deep{
span{
color: '#f00'
}
}
</style>
3.当项目中使用的css扩展语言是node-sass,需要使用/deep/或者::v-deep 深度选择器来修改 外用第三方组件的样式。
<style lang="scss" scoped>
.el-button::v-deep{
span{
color: '#f00'
}
}
/deep/.el-button{
span{
color: '#f00'
}
}
</style>
4、当项目中使用的 css 扩展语言是 dart-sass, 需要使用 ::v-deep 深度选择器来修改 外用第三方组件的样式,dart-sass不支持 /deep/ 和 >>> 的写法。
<style lang="scss" scoped>
.el-button::v-deep{
span{
color: '#f00'
}
}
</style>
总结:
② vue3.0 中使用 /deep/ 会报错,更推荐使用 ::v-deep
③ 对于使用了 css 预处理器(scss 、sass、 less)时,深度选择器 ::v-deep 比较通用

边栏推荐
- word插入公式/endnote
- STM32 - GPIO input / output mode
- Network security - vulnerabilities and Trojans
- One of the C language practical projects is greedy snake
- 函数的定义和调用、this、严格模式、高阶函数、闭包、递归
- [error record] an error is reported in the fluent interface (no mediaquery widget ancestor found. | scaffold widgets require a mediaquery)
- Network security - the simplest virus
- [leetcode] 797 and 1189 (basis of graph theory)
- Mathematical Knowledge: Steps - Nim Games - Game Theory
- C语言课程信息管理系统
猜你喜欢

STM32 - introduction of external interrupts exti and NVIC

Learn the five skills you need to master in cloud computing application development
![[shutter] animation animation (animatedbuilder animation use process | create animation controller | create animation | create components for animation | associate animation with components | animatio](/img/32/fa1263d9a2e5f77b0434fce1912cb2.gif)
[shutter] animation animation (animatedbuilder animation use process | create animation controller | create animation | create components for animation | associate animation with components | animatio
![[data mining] task 4:20newsgroups clustering](/img/76/af1d1338c468ec4825fe12816b84ff.png)
[data mining] task 4:20newsgroups clustering
![[data mining] task 6: DBSCAN clustering](/img/af/ad7aa523b09884eee967c6773a613f.png)
[data mining] task 6: DBSCAN clustering

【数据挖掘】任务2:医学数据库MIMIC-III数据处理

【数据挖掘】任务5:K-means/DBSCAN聚类:双层正方形

技术大佬准备就绪,话题C位由你决定

Tâche 6: regroupement DBSCAN

Force buckle 204 Count prime
随机推荐
Leetcode skimming questions_ Sum of two numbers II - enter an ordered array
Analysis, use and extension of open source API gateway apisex
STM32 - Application of external interrupt induction lamp
什么是调。调的故事
Everything file search tool
NCTF 2018 part Title WP (1)
[error record] navigator operation requested with a context that does not include a naviga
网络安全-钓鱼
Steps to obtain SSL certificate private key private key file
7-25 read numbers (loop switch)
Mathematical Knowledge: Steps - Nim Games - Game Theory
STM32 - GPIO input / output mode
网络安全-破解系统密码
¢ growth path and experience sharing of getting an offer
[shutter] animation animation (animatedwidget animation use process | create animation controller | create animation | create animatedwidget animation component | animation operation)
View of MySQL
Introduction to flask tutorial
A simple tool for analyzing fgui dependencies
Qtablewidget lazy load remaining memory, no card!
Everything文件搜索工具