創(chuàng)建theme.less文件
注意:路徑問題,反復(fù)嘗試過幾次,要慎重
在src目錄下創(chuàng)建style文件夾
在文件夾用創(chuàng)建theme.less

image.png
其實(shí)你可以在assets中創(chuàng)建,但是由于路徑問題總報(bào)錯(cuò),就自己創(chuàng)建了style文件夾
配置
1、build/webpack.base.conf.js
//配置顏色
let lessTheme = {
name:'less-theme',
path:'src/style/theme.less'
}
module.exports = vuxLoader.merge(webpackConfig, {
plugins: ['vux-ui', lessTheme ,'progress-bar', 'duplicate-style']
})
2、App .vue
引入theme.less,還是要注意路徑
<style lang="less">
@import '~vux/src/styles/reset.less';
@import './style/theme.less';
body {
background-color: #fbf9fe;
}
</style>
使用
可配置顏色
源碼地址:https://github.com/airyland/vux/blob/v2/src/styles/variable.less
根據(jù)官網(wǎng)提供
我們可以根據(jù)自己需要,在創(chuàng)建的theme.less文件中設(shè)置
例如:theme.less
@header-background-color: #ffffff;
@header-title-color: #000000;
@header-text-color: #ccc;
@header-arrow-color: #ccc;