解决步骤:
cd .\miniprogram\
npm init -y
npm i @vant/weapp -S --production
由于我们是在miniprogram目录下安装的,所以就不用修改project.config.json了
保持默认就好:
{
...
"setting": {
...
"packNpmManually": false,
"packNpmRelationList": []
}
}
// app.json
"usingComponents": {
"van-button": "path/to/@vant/weapp/dist/button/index"
}
<!-- index.wxml文件 -->
<van-button type="primary">按钮</van-button>