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

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