Hi,很高兴认识你~

世界很大,巧妙的是我们在这里相遇。

欢迎关注天宇文创意乐派,一个职场人的聚集地。

官网:https://youzan.github.io/vant/#/zh-CN/

01

vant 插件PullRefresh下拉刷新 会出现滚动就刷新的情况

常见问题:

1.父级容器不存在overflow:hidden

2.当使用Refresh插件时,如果存在当van-refresh组件的父级overfow-y:scorll 的样式时,选中的滚动条为父级元素,此时当body内部容器撑开页面元素时(也就是body存在滚动条时)

解决方式:

1.给父级容器加上overflow:hidden

2.设置van-refresh组件的父级组件的正确高度,使body的高度不会出现滚动条。

.van-pull-refresh {height: 100vh;overflow: auto !important;
}

PullRefresh 的内容未填满屏幕时,只有一部分区域可以下拉?默认情况下,下拉区域的高度是和内容高度保持一致的,如果需要让下拉区域始终为全屏,可以给 PullRefresh 设置一个与屏幕大小相等的最小高度:

vant ui 官网

02

vant  van-icon使用自定义图标

iconfont图标库: https://www.iconfont.cn/

搜索自己喜好的图标 添加入库

点击我的图标库  选择对应的项目  点击确定

点击更新代码

复制css代码到 Vue项目中

引入到项目中的位置 切记打包时 要配置http或https的形式

可以在App.vue 或main.js  我这里是配置在main.js中

vue文件中的使用

<template><div id="tabbar"><!-- 给tabbar route属性  然后给每一项to属性就可以路由跳转了 --><van-tabbar  route><van-tabbar-item icon="home-o" to="/">书架</van-tabbar-item><van-tabbar-item to="/bookShop" ><div class="customTabbarItem"><!--引入自定义图标--><van-icon class="iconfont iconicon_huabanfuben icon_margin"/><span>书城</span></div></van-tabbar-item><van-tabbar-item to="/bookClass" ><div class="customTabbarItem"><!--引入自定义图标--><van-icon class="iconfont iconleimupinleifenleileibie icon_margin"/><span>分类</span></div></van-tabbar-item><van-tabbar-item icon="user-o" to="/profile">我的</van-tabbar-item></van-tabbar></div>
</template>

03

vant swiper 轮播图圆角滑动变会变成直角然后再回到圆角(iOS)

#template部分
<van-pull-refresh v-model="isLoading" @refresh="init" :disabled="open" :style="{backgroundColor: bgColor}" class="pull-container"><!-- 轮播图 --><div class="cu-swipe" v-if="bannerList.length>0" ><van-swipe :autoplay="3000"><van-swipe-item v-for="(banner, index) in bannerList" :key="index" @click="toJump(banner)"><!-- 轮播图去掉 lazy-load 属性  --><van-image :src="STATIC_HOST + banner.imageLink"/></van-swipe-item></van-swipe></div><div class="book-list-container"><!-- 主编推荐 --><div class="book-recommend-wrapper"><div class="recommend-header"><div class="recommend-header-left"><h1>主编推荐</h1></div><div class="recommend-header-right"><div class="recommend-icon-item"><van-icon name="star" class="icon_margin" /><span>品质</span></div><div class="recommend-icon-item"><van-icon name="star" class="icon_margin"/><span>人气</span></div><div class="recommend-icon-item last"><van-icon name="star" class="icon_margin"/><span>兴趣</span></div></div></div><van-row type="flex" justify="space-between" v-if="recommendList.length>0"><van-col span="7" v-for="(recommend, index) in recommendList"><router-link :key="recommend.id" :to="{path: '/bookDetail', query:{bookId: recommend.id}}"><van-image class="recommend-cover" lazy-load :src="STATIC_HOST + recommend.coverImg" /><span class="recommend-title">{{recommend.title}}</span></router-link></van-col></van-row></div><!-- 高分神作  --><div class="book-eight-wrapper"><van-row class="book-eight-wrapper-header"><van-col span="24" class="header-left"><h1>高分神作</h1></van-col></van-row><van-row type="flex" justify="space-between" v-for="(i) in 2"><van-col span="5" v-for="(highScore, index) in highScoreList" v-if=" i===1 && index < 4 "><router-link :key="highScore.id" :to="{path: '/bookDetail', query:{bookId: highScore.id}}"><van-image class="book-eight-wrapper-cover" lazy-load :src="STATIC_HOST + highScore.coverImg" /><span class="book-eight-wrapper-title">{{highScore.title}}</span><span class="book-eight-wrapper-score">9.7<span class="unit">分</span></span></router-link></van-col><van-col span="5" v-for="(highScore, index) in highScoreList" v-if=" i===2 && index >= 4"><router-link :key="highScore.id" :to="{path: '/bookDetail', query:{bookId: highScore.id}}"><van-image class="book-eight-wrapper-cover" lazy-load :src="STATIC_HOST + highScore.coverImg" /><span class="book-eight-wrapper-title">{{highScore.title}}</span><span class="book-eight-wrapper-score">9.7<span class="unit">分</span></span></router-link></van-col></van-row></div><!--潜力新书--><div class="book-eight-wrapper"><div class="book-eight-wrapper-header"><div class="header-left"><h1>潜力新书</h1></div><div class="header-right"><a @click="handleMore('潜力新书','SERIAL')"><span>更多</span><span><van-icon class="iconfont icongengduo"/></span></a></div></div><van-row type="flex" justify="space-between" v-for="(i) in 2"><van-col span="5" v-for="(item, index) in newVos" v-if=" i===1 && index < 4 "><router-link :key="item.id" :to="{path: '/bookDetail', query:{bookId: item.id}}"><van-image class="book-eight-wrapper-cover" lazy-load :src="STATIC_HOST + item.coverImg" /><span class="book-eight-wrapper-title">{{item.title}}</span><span class="book-eight-wrapper-label">{{processLabelInfo(item.labelInfo)}}</span></router-link></van-col><van-col span="5" v-for="(item, index) in newVos" v-if=" i===2 && index >= 4"><router-link :key="item.id" :to="{path: '/bookDetail', query:{bookId: item.id}}"><van-image class="book-eight-wrapper-cover" lazy-load :src="STATIC_HOST + item.coverImg" /><span class="book-eight-wrapper-title">{{item.title}}</span><span class="book-eight-wrapper-label">{{processLabelInfo(item.labelInfo)}}</span></router-link></van-col></van-row></div><!--完结优选--><div class="book-eight-wrapper"><div class="book-eight-wrapper-header"><div class="header-left"><h1>完结优选</h1></div><div class="header-right"><a @click="handleMore('爆款完本','FINISH')"><span>更多</span><span><van-icon class="iconfont icongengduo"/></span></a></div></div><van-row type="flex" justify="space-between" v-for="(i) in 2"><van-col span="5" v-for="(item, index) in finishVos" v-if=" i===1 && index < 4 "><router-link :key="item.id" :to="{path: '/bookDetail', query:{bookId: item.id}}"><van-image class="book-eight-wrapper-cover" lazy-load :src="STATIC_HOST + item.coverImg" /><span class="book-eight-wrapper-title">{{item.title}}</span><span class="book-eight-wrapper-label">{{processLabelInfo(item.labelInfo)}}</span></router-link></van-col><van-col span="5" v-for="(item, index) in finishVos" v-if=" i===2 && index >= 4"><router-link :key="item.id" :to="{path: '/bookDetail', query:{bookId: item.id}}"><van-image class="book-eight-wrapper-cover" lazy-load :src="STATIC_HOST + item.coverImg" /><span class="book-eight-wrapper-title">{{item.title}}</span><span class="book-eight-wrapper-label">{{processLabelInfo(item.labelInfo)}}</span></router-link></van-col></van-row></div></div></van-pull-refresh>
#css部分
.pull-container {position: relative;min-height: 100vh;width: 100%;overflow-y: auto; //解决IOS 动态变化时 先变直角在变圆角的处理方案border: none;.van-hairline--bottom:after {border-bottom-width: 0;}.cu-swipe{margin: 0.533rem 0.533rem 0 0.533rem; //可以单独改变元素的上,右,下,左边距,也可以一次改变所有的属性。-webkit-border-radius: 0.267rem 0.267rem 0 0;-moz-border-radius: 0.267rem 0.267rem 0 0;overflow-y: auto; //解决IOS 动态变化时 先变直角在变圆角的处理方案.van-swipe-item {width: 100%;height: 4rem;font-size: 0.533rem;text-align: center;transform: translateY(0); //解决IOS 动态变化时 先变直角在变圆角的处理方案img{display:block;vertical-align:top;width: 100%;height: 4rem;}}}}

由于页面内容太多 我只粘贴主要部分不用直接上来就复制粘贴

04

vue  vant ui  vant-tab 标签页组件样式调整

<van-tabs
v-model="active"
sticky
title-active-color="#144a9e" // 选中的标签文字颜色
color="#144a9e" // 下面那个下划线颜色
@click="tabClick">

改变van-tab边框颜色 在类名前加上深度操作符: /deep/

/deep/.channel-tabs {.van-tab {border-right: 1px solid #edeff3;}}

改变van-tab 标签:宽高 文字颜色大小, 底部条:宽高 颜色 位置

.van-tabs__nav {  //父元素默认底边15px 可以去掉padding-bottom: 0;
}
.van-tabs__line {bottom: 8px;width: 31px !important;height: 6px;background-color: #3296fa;
}

目前暂时遇到以上的一些必写的  后续遇到在补充

vue vant ui 教程注意事项相关推荐

  1. 基于人工智能的智慧校园助手(springboot+springcloud+redis+vue+vant ui+element ui+mysql+Elasticsearch+RabbitMQ项目)

    部分功能演示地址 由于录视频时还没开发完,只有部分功能展示. 第一章 需求分析 学校是促进社会发展和个体发展的主要载体,随着信息化趋势的不断加强,信息技术越来越深度地融入高校的教育.教学及校园生活之中 ...

  2. vant显示日期格式_Vue+Vant ui实现日期时间选择

    Vue+Vant ui实现日期时间选择 1.安装Vant ui npm i vant -S 2.在 main.js 中引入 Vant ui // 引入vant import Vant from 'va ...

  3. Vue2 - 网易云音乐项目笔记(基于Vant UI组件库)

    目录 一.项目技术 二.准备工作 1.初始化Vue项目 2.配置Vant UI组件库 3.下载并使用vue-router库 4.接口API 5.postcss插件 三.分析页面实现功能 1.路由页面准 ...

  4. Vue项目实战——【基于 Vue3.x + Vant UI】实现一个多功能记账本(登录注册页面,验证码)

    基于 Vue3.x + Vant UI 的多功能记账本(四) 文章目录 基于 Vue3.x + Vant UI 的多功能记账本(四) 项目演示 1.登录注册页面 2.图片验证码 3.修改 axios ...

  5. vue h5 端实现富文本图片预览(基于 Vant UI 的 ImagePreview 组件)

    文章目录 vue h5 端实现富文本图片预览(基于 Vant UI 的 ImagePreview 组件) 预览效果 关键代码 使用案例 vue h5 端实现富文本图片预览(基于 Vant UI 的 I ...

  6. vue 移动端 跳转页面_Vue移动端框架Mint UI教程-跳转新页面(四)

    前三节写了vue的移动端框架的入门篇章,今天接着写,今天写的教程其实很简单,在之前的基础上,新建一个界面,并且进行跳转新页面. 1:首先,在pages底下新建一个新的页面fa.vue 在页面里面写一些 ...

  7. Vue移动端框架Mint UI教程-调用模拟json数据(五)

    1:安装 npm install vue-resource 2:打开main.js 注册 import VueResource from 'vue-resource' Vue.use(VueResou ...

  8. Vue如何使用Vant ui进行快速开发

    一.什么是Vant ui Vant 是有赞前端团队开源的移动端组件库,于 2017 年开源.是一款轻量.可靠的组件库. 能够大大提高我们的开发速度. ​​​​​​​Vant 2 - Mobile UI ...

  9. Vue项目实战——【基于 Vue3.x + Vant UI】实现一个多功能记账本(项目演示、涉及知识点、源码分享)

    基于 Vue3.x + Vant UI 的多功能记账本(一) 文章目录 基于 Vue3.x + Vant UI 的多功能记账本(一) Vue3.x 实现多功能记账本 1.前言 2.项目演示 3.涉及知 ...

  10. 12 款最棒 Vue 开源 UI 库测评 - 特别针对国内使用场景推荐

    本文首发:<12 款最棒 Vue 开源 UI 库测评 - 特别针对国内使用场景推荐> Vue 3 发布已经有一段时间了,就在刚刚过去的一年,各大组件库.框架纷纷对 Vue 3 做了优化和支 ...

最新文章

  1. linux查找用户前三进程_查看 Linux 系统中进程和用户的内存使用情况 | Linux 中国...
  2. python3 字典 dict 常见用法总结(判断key是否存在)
  3. python语言自学-零基础小白学习Python编程语言的正确姿势(纯干货)
  4. jmeter根据循环获取参数_jmeter forEach循环获取response参数值进行接口请求
  5. js模板引擎——art Template
  6. 工质热物理性质计算程序的编制及应用_新能源动力电池热管理方案设计和热流体仿真...
  7. 人工智能AI实战100讲(八)-原理+代码详解 | 稠密重建之SGM/tSGM算法
  8. 前端学习(2443):反馈
  9. 修改DNS的Linux脚本,Shell脚本-配置网络
  10. linux 自动发邮件脚本,科学网—用linux脚本自动发送和收取邮件 - 周宇的博文
  11. K-means均值聚类算法的原理与实现
  12. 著名音频库多角度对比(多平台可用)
  13. python编程框架_python编程基础框架
  14. html文件怎么用华为手机打开,如何调整华为手机中的文件默认打开方式
  15. 顺序表基本操作归纳整理
  16. Boni Satani谈迁移遗留系统的5个原因
  17. 思科交换机配置【串口初始配置】
  18. win7右击应用程序资源管理器停止工作问题
  19. 微信小程序的购物车功能
  20. 2018阿里巴巴春招面试

热门文章

  1. 最新SSD固态硬盘颗粒QLC、SLC、MLC、TLC详解
  2. macbook电池用什么软件测试,Wattagio Mac_Wattagio For Mac(电池检测软件) v1.1苹果电脑版 - 121苹果网...
  3. 怎么用计算机打对错,丶符号怎么打-Word里的对√ 和 错× 怎么打出来的?
  4. 一键清理C盘垃圾文件,让你的电脑运行飞起
  5. 信息安全技术及应用 系统安全防护技术
  6. 前端实现鼠标拖拽功能
  7. 电信光猫F652破解经验谈
  8. 电信光猫 远程服务器,如何禁止电信远程控制服务器修改光猫配置信息
  9. 软件开发项目计划书编写说明
  10. 如何下载安装 Visual Studio2010