1. 在根目錄下創建wxcomponents,wxcomponents下建文件夾vant
2.項目引入
1.在https://github.com/youzan/vant-weapp下載最新的zip壓縮包
2.解壓,將裏面的dist文件放到vant裏面
3.在App.vue中引入UI樣式
@import "/wxcomponents/vant/dist/common/index.wxss";
4.在pages裏面定義引入的組件
![image](https://upload-images.jianshu.io/upload_images/16629650-602209476a1dd21f.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
"usingComponents":{
"van-button": "/wxcomponents/vant/dist/button/index"
}
5.在組件中使用
https://youzan.github.io/vant-weapp/#/button和官網的使用方法一樣。
如果報錯找不到文件位置,關閉hbuider和微信小程序重啓一下