First check whether there is a package.json file in the root directory of the applet
If not, open cmd in the project root directory, enter npm init -y
initialization, and initialize a package management
Install the vant weapp package
Enter in the cmd of the root directory npm i @vant/[email protected] -S --production
to install @ and you can specify the version
Modify app.json
Remove "style": "v2" from app.json, and the new version of the applet's basic components forcefully add many styles, which are difficult to overwrite. If they are not closed, the styles of some components will be confused.
build npm
custom theme color
Custom theme color
https://github.com/youzan/vant-weapp/blob/dev/packages/common/style/var.less
Define the color under the page in the applet app.wxss
page {
--button-default-color: #ff0000;
}
Use vanbutton normally in the page
<van-button type="default">默认按钮</van-button>