最近,发现一款颜值杠杆的微信小程序UI组件库-Vant Weapp。记录下使用方法。
使用步骤
一、下载源代码
需要到gitee上下载源代码,github也有,但是最近经常抽风。
直接执行下面命令也行。
git clone https://gitee.com/vant-contrib/vant-weapp.git
二、引用组件
以 Button 组件为例,只需要在app.json或index.json中配置 Button 对应的路径即可。
// 通过下载源码使用 es5版本,注意是lib路径
// app.json
"usingComponents": {
"van-button": "path/to/@vant/weapp/lib/button/index"
}
注意,引用Button组件除了button外,还要common、icon、info、loading、mixins、wxs这些组件。