1. Install vant dependencies
npm i vant -S
Copy the code
  1. Injected into the project, the article is automatically loaded on demand
NPM I babel-plugin-import -dCopy the code
{"plugins": [["import", {"libraryName": "vant", "libraryDirectory": "es", "style": true}]]}Copy the code
Import {Button} from 'vant'; Vue.use(Button)Copy the code
  1. Vant/SRC /style/var.less

Then create a file in your own project, for example mine is resetless.less

Modify the desired color inside

  1. Modify until. Js under build

less: generateLoaders('less', { modifyVars: { 'hack': `true; @import "${path.join(__dirname, '.. /src/common/resetLess.less')}"` } }),Copy the code
  1. Modify. Babelrc

["import", {
    "libraryName": "vant",
    "libraryDirectory": "es"
    // "style": true
  }]
Copy the code

// “style”: true

  1. Restart the service