**1.**首先要建立一个miniprogram文件夹,在npm init -y,否则会报错。
在 npm i @vant/weapp -S --production
F:\vant 组件使用\miniprogram>npm init -y
Wrote to F:\vant 组件使用\miniprogram\package.json:
{
"name": "miniprogram",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC"
}
F:\vant 组件使用\miniprogram>npm i @vant/weapp -S --production
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN miniprogram@1.0.0 No description
npm WARN miniprogram@1.0.0 No repository field.
+ @vant/weapp@1.4.3
added 1 package from 1 contributor and audited 1 package in 1.651s
found 0 vulnerabilities
F:\vant 组件使用\miniprogram>
2.在小程序工具头部导航栏里面有个工具–>构建npm
3.小程序右边详情–>本地设置–> 勾选使用npm模块
**4.**最后一步
将 app.json 中的 “style”: “v2” 去除,小程序的新版基础组件强行加上了许多样式,难以去除,不关闭将造成部分组件样式混乱。加入usingComponents
随便找个复制就好,完事