赞
踩
先在项目文件下 cmd进入终端
npm init -y 生成一个package-lock.json文件 进行初始化项目配置
引入vant 包 :npm install vant --save
或者npm i @vant/weapp -S --production
然后在详情中勾选下列选项
这里es6转es5可勾可不勾
一定要勾选使用npm模块
然后在开发者工具中 工具–>构建npm
接下来就可以看到一个 miniprogram_npm的文件夹
在app.json中或者index.json中添加 配置
"usingComponents": { "van-button": "@vant/weapp/button/index", "van-slider":"@vant/weapp/slider/index", "van-tree-select":"@vant/weapp/tree-select/index", "van-popup": "@vant/weapp/popup/index", "van-cell": "@vant/weapp/cell/index", "van-cell-group": "@vant/weapp/cell-group/index", "van-icon": "@vant/weapp/icon/index", "van-image": "@vant/weapp/image/index", "van-row": "@vant/weapp/row/index", "van-col": "@vant/weapp/col/index", "van-transition": "@vant/weapp/transition/index", "van-calendar": "@vant/weapp/calendar/index", "van-uploader": "@vant/weapp/uploader/index", "van-action-sheet": "@vant/weapp/action-sheet/index", "van-goods-action": "@vant/weapp/goods-action/index", "van-goods-action-icon": "@vant/weapp/goods-action-icon/index", "van-goods-action-button": "@vant/weapp/goods-action-button/index", "van-submit-bar": "@vant/weapp/submit-bar/index", "van-grid": "@vant/weapp/grid/index", "van-grid-item": "@vant/weapp/grid-item/index" },
在index.wxml中引入组件
<van-slider value="50" bar-height="4px" active-color="#ee0a24" />
<van-cell title="展示弹出层" is-link bind:click="showPopup" />
<van-popup
show="{
{ show }}"
赞
踩
赞
踩
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。