步骤一
npm init
npm i @vant/weapp -S --production
步骤二
打开微信小程序 > 工具 > 构建npm
出现以下提示表示构建成功,这时项目根目录中出现 miniprogram_npm,这是第三方库
步骤三
打开小程序对应页面中的xx.json,引入相对应的组件路径
{
"usingComponents":{
"van-button":"/miniprogram_npm/vant-weapp/button/index"
}
}
在对应的wxml中引入相关组件
<vant-button type="primary">按钮</vant-button>
------------------------------------------- 完 ----------------------------------------------