一.打開小程序項目,選中miniprogram,右鍵在「終端打開」git
輸入命令:npm init(記得以管理員身份運行開發工具),而後一直回車,直至在miniprogram文件夾下,生成package.json文件。github
二.打開官網,https://youzan.github.io/vant-weapp/#/intronpm
經過npm安裝,執行如下命令json
1:npm install --production小程序
2: npm i @vant/weapp -S --production微信
三.構建 npm 包
打開微信開發者工具,點擊 工具 -> 構建 npm,並點擊詳情,勾選 使用 npm 模塊 選項,構建完成後,便可引入組件微信開發
四:引入組件app
在子頁面中的.json文件。工具
將 "van-button": "path/to/@vant/weapp/dist/button/index"開發工具
改成:"van-button": "@vant/weapp/button"
在wxml文件中,加入:
van-button type="danger">危險按鈕</van-button>