洪海洋 2019-06-25
综合比较了一些前端的UI,最后还是决定用mint-ui,但是默认的风格是蓝色,我要改成微UI的绿色。
其实也就主要修改颜色#26a2ff改为#1aad19。
部分效果如下:
下面直入正题,仅需2个步骤,如下:
1、新建/src/styles/weui.scss文件,覆盖mint-ui的primary颜色。
PS:我是安装了node-sass的,如果没有安装的童鞋,请自行修改weui.scss文件和里面的颜色。
/* 覆盖mint-ui的primary颜色,改为微信UI的绿色 */ $color-primary: #1aad19; .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; }
2、main.js引入mint-ui(这里仅为了展示如何覆盖样式,使用的全局引入)
import MintUI from 'mint-ui'; import 'mint-ui/lib/style.min.css' import './styles/weui.scss'; //核心,多了这一行用上边的样式覆盖默认的primary颜色 Vue.use(MintUI);
PS:如果还有其他颜色改漏了,可参考https://weui.io/对应调
background-color: blue;background-color: yellow;<input type="button" value="变蓝" @click="changeColorT