美文网首页小程序开发
小程序:使用Vant Weapp

小程序:使用Vant Weapp

作者: 东方晓 | 来源:发表于2022-01-12 13:27 被阅读0次

2022-01-12

介绍

Vant 是有赞前端团队开源的移动端组件库,于 2017 年开源,已持续维护 4 年时间。Vant 对内承载了有赞所有核心业务,对外服务十多万开发者,是业界主流的移动端组件库之一。

目前 Vant 官方提供了 Vue 2 版本Vue 3 版本微信小程序版本,并由社区团队维护 React 版本支付宝小程序版本

安装Vant Weapp

# 通过 npm 安装
npm i @vant/weapp -S --production

# 通过 yarn 安装
yarn add @vant/weapp --production

# 安装 0.x 版本
npm i vant-weapp -S --production

微信编辑器开启npm支持

npm install

构建npm

点击开发者工具中的菜单栏:工具 --> 构建 npm


构建完后即可使用npm包

引入组件

// 通过 npm 安装
// app.json
"usingComponents": {
  "van-button": "@vant/weapp/button/index"
}

使用组件

<van-button type="primary">按钮</van-button>

相关文章

网友评论

    本文标题:小程序:使用Vant Weapp

    本文链接:https://www.haomeiwen.com/subject/tedwcrtx.html