1、初始化npm并安装
npm init -y
npm install
2、修改project.config.json
{ "setting": { "packNpmManually": true, "packNpmRelationList": [ { "packageJsonPath": "./package.json", "miniprogramNpmDistDir": "./" } ] } }
3、安装vant
npm i @vant/weapp -S --production
4、选择微信开发者工具的“工具”选项,点击构建npm,会出现两个依赖文件miniprogram_npm和node_modules,使用前者
5、在页面的json文件中引用,wxml中使用<van-button></van-button>
{ "usingComponents": { "van-button": "@vant/weapp/button/index" } }
6、要删除app.json的style:"v2"设置,否则会造成vant的样式错乱
标签:npm,vant,程序安装,微信,weapp,json From: https://www.cnblogs.com/yseraaa/p/17026660.html