问题一:样式类型scss/less/css
如果公共样式为common.scss
对应的App.vue文件必须加上lang=“scss”
<style lang="scss">@import "@/common/css/common.scss";page{}</style>
问题二:深入修改样式
①当前页面修改,带scoped,css样式;
<style scoped>.index_list_bar >>> .uni-section{background-color:#fff;margin:0px; font-weight:700; height:80rpx;}</style>
备注:对子组件样式不生效;且微信小程序会报错,需使用条件编译作区分
②当前页面修改,带scoped,css样式/scss样式
<style scoped>/deep/ .index_list_bar .uni-section{background-color:#fff;margin:0px; font-weight:700; height:80rpx;}</style><style lang="scss" scoped>/deep/ .index_list_bar{.uni-section{background-color:#fff;margin:0px; font-weight:700; height:80rpx;}}</style><style lang="scss" scoped>/deep/ .index_list_bar .uni-section{background-color:#fff;margin:0px; font-weight:700; height:80rpx;}</style>
备注:子组件,h5,APP,小程序均可生效
③当前页面修改,带scoped,scss样式;
<style lang="scss" scoped>::v-deep .index_list_bar{.uni-section{background-color:#fff!important;margin:0px!important; font-weight:700!important; height:80rpx!important;}}</style>
备注:子组件亦能生效;h5生效,但APP无效
④common.scss公共样式中
::v-deep .index_list_bar{.uni-section{background-color:#fff!important;margin:0px!important; font-weight:700!important; height:80rpx!important;}}
备注:APP不生效,H5及微信小程序、子组件均生效
总结:可使用第四种方法,APP使用条件编译语句在需修改样式的页面配合②一起使用
//common.scss::v-deep .index_list_bar{.uni-section{background-color:#fff!important;margin:0px!important; font-weight:700!important; height:80rpx!important;}}//index.vue首页中/deep/ .index_list_bar{.uni-section{background-color:#fff;margin:0px; font-weight:700; height:80rpx;}}
来源地址:https://blog.csdn.net/qq_43628158/article/details/128329901