vant-weapp
1、在对应的项目中的 pages右键 在终端打开
2、进入项目的根目录地下,返回上一级目录 cd …/
3、小程序已经支持使用npm安装第三方包
// 第一步
npm init
// 第二步
npm install --production
// 第三步
//(推荐)
npm i @vant/weapp -S --production
// 或者
npm i vant-weapp -S --production
这里需要注意一下
引入的时候,使用npm i vant-weapp安装的时候,在app.json或index.json中引入组件,需要使用
{
"usingComponents": {
"vant-button": "../../miniprogram_npm/vant-weapp/button/index"
}
}
使用npm i @vant/weapp安装的时候,在app.js或index.json中引入组件
{
"usingComponents": {
"vant-button": "@vant/weapp/button/index"
}
}
4、在微信开发工具执行npm构建,点击工具-构建npm
构建成功会在项目中生成一个miniprogram_npm