按需加载得先在 babel.config.js 中配置
module.exports = {
plugins: [
[
'import',
{
libraryName: 'vant',
libraryDirectory: 'es',
// 指定样式路径
style: name => `${name}/style/less`
},
'vant'
]
]
};
然后再配置主题色
loaderOptions: {
less: {
modifyVars: {
red: '#03a9f4',
blue: '#3eaf7c',
orange: '#f08d49',
'text-color': '#111',
'active-color': '#B4E7A0',
}
}
}