uniapp微信小程序使用Vant Weappui框架方法

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和微信小程序重啓一下

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章