mpvue——引入vant_weapp组件
克隆仓库
克隆后,将dist目录下的所有文件复制到项目中的/static/vant/目录下,vant目录是我自己创建为了区分的
git clone https://github.com/youzan/vant-weapp.git
注意:一定要确保复制完全了,我当时复制的时候common文件夹没复制过来,就出现错误了!

引入
直接在用的页面的main.json中引用了,这里的配置是根据我的目录结构来的,如果你和我前面的操作一致,那么直接复制粘贴就可以了,不然就要自己修改哦~
https://youzan.github.io/vant-weapp/#/intro官方文档,有些新功能更新,这里的引入可能还没加进来,大家可以自己去官方的网站看下
"usingComponents": {
"van-action-sheet": "/static/vant/cell-group/index",
"van-area": "/static/vant/area/index",
"van-badge": "/static/vant/badge/index",
"van-badge-group": "/static/vant/badge-group/index",
"van-button": "/static/vant/button/index",
"van-card": "/static/vant/card/index",
"van-cell": "/static/vant/cell/index",
"van-cell-group": "/static/vant/cell-group/index",
"van-checkbox": "/static/vant/checkbox/index",
"van-checkbox-group": "/static/vant/checkbox-group/index",
"van-col": "/static/vant/col/index",
"van-collapse": "/static/vant/collapse/index",
"van-datetime-picker": "/static/vant/datetime-picker/index",
"van-dialog": "/static/vant/dialog/index",
"van-field": "/static/vant/field/index",
"van-goods-action": "/static/vant/goods-action/index",
"van-goods-action-button": "/static/vant/goods-action-button/index",
"van-goods-action-icon": "/static/vant/goods-action-icon/index",
"van-icon": "/static/vant/icon/index",
"van-info": "/static/vant/info/index",
"van-loading": "/static/vant/loading/index",
"van-nav-bar": "/static/vant/nav-bar/index",
"van-notice-bar": "/static/vant/notice-bar/index","van-notify": "/static/vant/notify/index",
"van-overlay": "/static/vant/overlay/index",
"van-panel": "/static/vant/panel/index",
"van-picker": "/static/vant/picker/index",
"van-picker-column": "/static/vant/picker-column/index",
"van-popup": "/static/vant/popup/index",
"van-progress": "/static/vant/progress/index",
"van-radio": "/static/vant/radio/index",
"van-radio-group": "/static/vant/radio-group/index",
"van-rate": "/static/vant/rate/index",
"van-row": "/static/vant/row/index",
"van-search": "/static/vant/search/index",
"van-slider": "/static/vant/slider/index",
"van-stepper": "/static/vant/stepper/index",
"van-steps": "/static/vant/steps/index",
"van-submit-bar": "/static/vant/submit-bar/index",
"van-swipe-cell": "/static/vant/swipe-cell/index",
"van-switch": "/static/vant/switch/index",
"van-switch-cell": "/static/vant/switch-cell/index",
"van-tab": "/static/vant/tab/index",
"van-tabbar": "/static/vant/tabbar/index",
"van-tabbar-item": "/static/vant/tabbar-item/index",
"van-tabs": "/static/vant/tabs/index",
"van-tag": "/static/vant/tag/index",
"van-toast": "/static/vant/toast/index",
"van-tree-select": "/static/vant/tree-select/index"
}

使用
在页面中直接使用就ok了,只要和引入中命名一致
<van-cell-group name="form-list">
<div class="form-item">
<label class="label-text" for="prizeName">奖品名称</label>
<van-field
class="input"
adjust-position="true"
input-align="right"
id="prize"
name="prizeName"
v-model="contactFormData.prizeName"
placeholder="请输入奖品名称"
/>
</div>
<div class="form-item">
<label class="label-text" for="prizeNumber">奖品数量</label>
<van-field
class="input"
adjust-position="true"
input-align="right"
id="prizeNumber"
name="prizeNumber"
type="number"
v-model="contactFormData.prizeNumber"
placeholder="请输入奖品数量"
onkeyup = "value=value.replace(/[^0-9]/g,'')"
onpaste = "value=value.replace(/[^0-9]/g,'')"
oncontextmenu = "value=value.replace(/[^0-9]/g,'')"
/>
</div>
<div class="form-item">
<label class="label-text" for="userName">联系人</label>
<van-field
class="input"
adjust-position="true"
input-align="right"
id="userName"
name="userName"
v-model="contactFormData.userName"
placeholder="请输入姓名"
/>
</div>
<div class="form-item">
<label class="label-text" for="mobile">联系电话</label>
<van-field
class="input"
adjust-position="true"
input-align="right"
id="mobile"
name="mobile"
type="number"
v-model="contactFormData.mobile"
placeholder="请输入联系电话"
maxlength="11"
/>
</div>
<div class="form-item">
<label class="label-text" for="goodsLink">商品链接</label>
<van-field
class="input"
adjust-position="true"
input-align="right"
id="goodsLink"
name="goodsLink"
v-model="contactFormData.goodsLink"
placeholder="请输入商品链接"
/>
</div>
<div class="form-item h200">
<label class="label-text" for="prize">备注信息</label>
<van-field
class="input-big"
adjust-position="true"
type="textarea"
id="remark"
name="remark"
v-model="contactFormData.remark"
rows="2"
autosize
placeholder="请输入备注信息"
/>
</div>
</van-cell-group>
不要忘记,引入后重新编译一下哦!
mpvue——引入vant_weapp组件的更多相关文章
- MpVue开发之组件引入的问题
再一次开发订餐系统中,遇到订餐页面引入头部商品列表,底部组件时,报错,模块编译失败,未进入缓存区. 我以为是新添加的模块没有重新启动导致的,然后重新与运行npm run dev后还是失败, 最后经过反 ...
- mpvue——引入antv-F2图表
踩坑中~ 官方文档 https://www.yuque.com/antv/f2/intro 毕竟不像echarts接触过,所以还是先看看文档较好 github https://github.com/s ...
- 想在已创建的Vue工程里引入vux组件
<1>. 在项目里安装vux npm install vux --save <2>. 安装vux-loader (这个vux文档似乎没介绍,当初没安装结果报了一堆错误) npm ...
- Vue:如何在vue-cli中创建并引入自定义组件
一.创建并引入一个组件 1.创建组件 vue-cli中的所有组件都是存放在components文件夹下面的,所以在components文件夹下面创建一个名为First.vue的自定义组件: <t ...
- 不再手写import - VSCode自动引入Vue组件和Js模块
:first-child{margin-top:0!important}.markdown-body>:last-child{margin-bottom:0!important}.markdow ...
- react 项目实战(十)引入AntDesign组件库
本篇带你使用 AntDesign 组件库为我们的系统换上产品级的UI! 安装组件库 在项目目录下执行:npm i antd@3.3.0 -S 或 yarn add antd 安装组件包 执行:npm ...
- html页面引入vue组件
html页面引入vue组件需要在页面引入http-vue-loader.js 注意:要查看页面引入vue组件的效果不能直接在本地打开index.html,会有跨域问题,可以在本地配置一个nginx转发 ...
- js 实现vue—引入子组件props传参
参考:https://www.cnblogs.com/xiaohuochai/p/7388866.html 效果 html <!DOCTYPE html> <html> < ...
- uni-app开发微信小程序引入UI组件库(Vant-weapp)步骤
uni-app开发微信小程序引入UI组件库(Vant-weapp)步骤 这里以vant-weapp为例 uni-app官方文档介绍引入组件的方法 1. 新建相关目录 根目录下创建 wxcomponen ...
随机推荐
- Html和Css学习笔记-css基础知识
我的邮箱地址:zytrenren@163.com欢迎大家交流学习纠错! 此篇博客是我的复习笔记,html和css学的时间太久了,忘得差不多了,最近要使用一下,所以重新打开html的书略读,后记录了标签 ...
- 深海中的STL—nth_element
如果让你求区间第\(k\)大,你会怎么做呢? 主席树?确实是个不错的选择(不过像我这种垃圾还是乖乖打暴力吧) 在c++的stl库中,提供了nth_element这样一个函数 它的用法是nth_elem ...
- 记一次与iframe之间的抗争
iframe这个标签之前了解过这个东西,知道它可以引入外来的网页,但是实际开发中没有用到过.这一次有一个需求是说准备要在网页中嵌套另外一个网站,用iframe这个标签,让我测试一下这个可不可以在自己的 ...
- JMeter中文返回乱码
JMeter中文返回乱码 结果树响应数据中文返回乱码 其实有几个方法: 在线程组->http请求的字符集里设置 在http 消息管理头中设置 3.如果以上方法还没有解决,请打开安装目录 ...
- Spark之谓词下推
谓词下推就是指将各个条件先应用到对应的数据上,而不是根据写入的顺序执行,这样就可以先过滤掉部分数据,降低join等一系列操作的数据量级,提高运算速度,如下图:
- 关于在Python2中使用列表推导式会遇到的问题
摘自<流畅的Python>第二部分第二章2.2 Python 2.x 中,在列表推导中 for 关键词之后的赋值操作可能会影响列表推导上下文中的同名变量.像下面这个 Python 2.7 ...
- SQL Sever AlwaysOn的数据同步原理
1. SQL Server AlwaysOn数据同步基本工作 AlwaysOn 副本同步需要完成三件事: 1.把主副本上发生的数据变化记录下来. 2.把这些记录传输到各个辅助副本. 3.把数据变化在辅 ...
- 【原】Java学习笔记002 - JAVA SE编码规范
/* * 编码规范: * 1.所有的命名遵循"见名知意"的原则 * 2.所有的命名不允许使用汉字或拼音 * 3.Java的工程命名建议使用小写,比如:oa.crm.cms... * ...
- Docker: Harbor一些小知识
镜像文件上传到私有仓库harbor后,镜像的物理存储位置在哪里? 这些信息记录在docker-compose.yml里,通过观察发现 镜像存储在了宿主机的 volumes: - /data/regis ...
- 软件设计之Deep Module(深模块)
类是不是越小越好?最近在读John Ousterhout的<A Philosophy of Software Design>,感到作者文笔流畅,书中内容具有启发性.这里摘要一部分内容,以供 ...