綜合比較了一些前端的UI,最後仍是決定用mint-ui,可是默認的風格是藍色,我要改爲微UI的綠色。
其實也就主要修改顏色#26a2ff改成#1aad19。css
部分效果以下:
前端
下面直入正題,僅需2個步驟,以下:
一、新建/src/styles/weui.scss文件,覆蓋mint-ui的primary顏色。
PS:我是安裝了node-sass的,若是沒有安裝的童鞋,請自行修改weui.scss文件和裏面的顏色。node
/* 覆蓋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; }
二、main.js引入mint-ui(這裏僅爲了展現如何覆蓋樣式,使用的全局引入)sass
import MintUI from 'mint-ui'; import 'mint-ui/lib/style.min.css' import './styles/weui.scss'; //核心,多了這一行用上邊的樣式覆蓋默認的primary顏色 Vue.use(MintUI);
PS:若是還有其餘顏色改漏了,可參考https://weui.io/對應調微信