修改mint-ui默认样式
程序员文章站
2022-04-22 19:40:04
...
Mint UI 是基于 Vue.js 的移动端组件库,有时候我们需要修改它的默认样式,方法如下:
1. 安装sass的依赖包(前提:已安装node环境)
由于sass-loader依赖于node-sass,所以先安装node-sass:
cnpm install --save-dev node-sass
安装sass-loader:
cnpm install --save-dev sass-loader
2. 在src/assets/css目录下新建scss文件,如:my-mint.scss,内容如下:
/* 覆盖mint-ui的primary颜色,改为自己UI的主题色 */
$color-primary: orange;
.mint-header {
background-color: $color-primary;
}
.mint-button:not(.is-disabled):active::after {
opacity: .2 /* .6 */
}
.mint-button--primary {
background-color: $color-primary;
}
.mint-button--primary.is-plain {
border: 1px solid $color-primary;
color: $color-primary
}
.mint-badge.is-primary {
background-color: $color-primary
}
.mint-switch-input:checked + .mint-switch-core {
border-color: $color-primary;
background-color: $color-primary;
}
.mint-navbar .mint-tab-item.is-selected {
border-bottom: 3px solid $color-primary;
color: $color-primary;
}
.mint-tabbar > .mint-tab-item.is-selected {
color: $color-primary;
}
.mint-searchbar-cancel {
color: $color-primary;
}
.mint-checkbox-input:checked + .mint-checkbox-core {
background-color: $color-primary;
border-color: $color-primary;
}
.mint-radio-input:checked + .mint-radio-core {
background-color: $color-primary;
border-color: $color-primary;
}
.mt-range-progress {
background-color: $color-primary;
}
.mt-progress-progress {
background-color: $color-primary;
}
.mint-msgbox-confirm {
color: $color-primary;
}
.mint-msgbox-confirm:active {
color: $color-primary;
}
.mint-datetime-action {
color: $color-primary;
}
3. 在main.js中引入自定义的scss文件
import './assets/css/my-mint.scss';//全局修改mint-UI样式
上一篇: 解决ElementUI中默认样式的修改