vue开发移动端底部导航条功能


Posted in Javascript onApril 08, 2020

效果图

vue开发移动端底部导航条功能 

src/app.vue

<template>
 <div id="app" class="g-container">
  <div class="g-header-container">
   头部导航
  </div>
  <div class="g-view-container">
   <div class="content">
    内容区域
   </div>
   
  </div>
  <div class="g-footer-container">
   <tabbar />
  </div>
 </div>
</template>

<script>
 import Tabbar from 'components/tabbar';

 export default {
  name: 'App',
  components:{
   Tabbar
  }
 }
</script>

<style scoped>
 .g-container{
  position: relative;
  width:100%;
  height:100%;
  max-width:640px;
  min-width:320px;
  margin:0 auto;
  overflow:hidden; 
 }
 .g-header-container{
  position:absolute;
  left:0;
  top:0;
  width:100%;
  z-index:999;
  height:64px;
  background:pink; 
 }
 .g-view-container{
  height:100%;
  padding-bottom:50px;
  background:lightblue;
  overflow:auto;
 }
 .content{
  height:2000px;
 }
 .g-footer-container{
  position:absolute;
  left:0;
  bottom:0;
  width:100%;
  box-shadow:0 0 10px 0 hsla(0,6%,58%,0.6);
  height:50px;
  z-index:999;
  background:lightgreen;
 }
</style>

src/components/tabbar/index.vue

<template>
  <div class="g-tabbar">
    <router-link class="g-tabbar-item" to="/home">
      <i class="iconfont icon-home"></i>
      <span>首页</span>
    </router-link>
    <router-link class="g-tabbar-item" to="/category">
      <i class="iconfont icon-category"></i>
      <span>分类页</span>
    </router-link>
    <router-link class="g-tabbar-item" to="/cart">
      <i class="iconfont icon-cart"></i>
      <span>购物车</span>
    </router-link>
    <router-link class="g-tabbar-item" to="/personal">
      <i class="iconfont icon-personal"></i>
      <span>个人中心</span>
    </router-link>
  </div>
</template>

<script>
export default {
  name:"Tabbar"
}
</script>

<style lang="scss" scoped>
  .g-tabbar{
    display:flex;
    width:100%;
    height:50px;
    background:#fff;

    &-item{
      flex:1;
      display: flex;
      justify-content: center;
      align-items: center;
      flex-direction: column;
      color:#333;
      font-size:12px;

      .iconfont{
        margin-bottom:4px;
        font-size:18px;
      }
    }

  }
  .router-link-active{
    color:red;
  }
</style>

src/assets/scss/_icons.scss

@font-face {
 font-family: "iconfont";
 src: url('../fonts/iconfont.eot?t=1522237704791'); /* IE9*/
 src: url('../fonts/iconfont.eot?t=1522237704791#iefix') format('embedded-opentype'), /* IE6-IE8 */
 url('data:application/x-font-woff;charset=utf-8;base64,d09GRgABAAAAABFEAAsAAAAAGkgAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAABHU1VCAAABCAAAADMAAABCsP6z7U9TLzIAAAE8AAAAQgAAAFZW7kpQY21hcAAAAYAAAADwAAAC3hDqdNdnbHlmAAACcAAADEcAABH09Z93/mhlYWQAAA64AAAAMQAAADYQ3YfraGhlYQAADuwAAAAgAAAAJAfZA9hobXR4AAAPDAAAABsAAABMTC7/+2xvY2EAAA8oAAAAKAAAACgoVix8bWF4cAAAD1AAAAAdAAAAIAEnAMhuYW1lAAAPcAAAAUUAAAJtPlT+fXBvc3QAABC4AAAAiQAAALvQPTpueJxjYGRgYOBikGPQYWB0cfMJYeBgYGGAAJAMY05meiJQDMoDyrGAaQ4gZoOIAgCKIwNPAHicY2BkYWKcwMDKwMHUyXSGgYGhH0IzvmYwYuRgYGBiYGVmwAoC0lxTGBwYKl7EMDf8b2AAkgwNQGFGkBwA2tsL1QAAeJzFkjFuwkAQRf8GB+LEiQ0FdYQsqrScgJYjcBCugMQFuAEFx+Asf12mikRF/vjTUESkiTKrZ+2OvjWz+wfAI4CB+BAFkL6QEPGpbOrzAzz3+QInnVu8a1dgw5IVG045Y8sFl1xxyz2PeZcP+dytLxeprarvqO5FUlWv+Y8rVAXeUKnfJ93qFRP1/YIHNCgxxhAj1BINf1HvjyL9X+nbqPpvdz1NxOaKWmRpYhpYGb0rWJv4m42JyeHU6NXBmYmpYmvkBLgwUYtLE1PFlZFP4NbIMXBvEHWORi4i74z8RD4YOYt8NvIY3dqg/gapw2EVeJylVwuMHMdx7Zqe/8zu7Oz89nP7m7md0d3eLe/2e9y9Dy0eSR1F8kjJpERJZ1KiY1q0KYqmBSs2LTK04wgQITkQRJmyDIOS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ghECPp4nGNgZGBgEGbYw8DFAAJMQMwFZv8H8xkAHY0B8AAAAHicZY9NTsMwEIVf+gekEqqoYIfkBWIBKP0Rq25YVGr3XXTfpk6bKokjx63UA3AejsAJOALcgDvwSCebNpbH37x5Y08A3OAHHo7fLfeRPVwyO3INF7gXrlN/EG6QX4SbaONVuEX9TdjHM6bCbXRheYPXuGL2hHdhDx18CNdwjU/hOvUv4Qb5W7iJO/wKt9Dx6sI+5l5XuI1HL/bHVi+cXqnlQcWhySKTOb+CmV7vkoWt0uqca1vEJlODoF9JU51pW91T7NdD5yIVWZOqCas6SYzKrdnq0AUb5/JRrxeJHoQm5Vhj/rbGAo5xBYUlDowxQhhkiMro6DtVZvSvsUPCXntWPc3ndFsU1P9zhQEC9M9cU7qy0nk6T4E9XxtSdXQrbsuelDSRXs1JErJCXta2VELqATZlV44RelzRiT8oZ0j/AAlabsgAAAB4nG2M2w6CMBAFe2ShiHfxB+u6AWJhSbsx+vdCfHVeTjLJGbdxPxr3nxYbFCCUqOBRY4sGO+xxwBEnnHHBFS1uDm9/D/w0netZUtYpRMocppKjhFSMuas5mHSaPlVeDPfVQ6KY+CzpNfC6ZsPU0Zqh3Ou8XDULjZqEeh3Fs8YobMQhmXNfhBQomAAAAA==') format('woff'),
 url('../fonts/iconfont.ttf?t=1522237704791') format('truetype'), /* chrome, firefox, opera, Safari, Android, iOS 4.2+*/
 url('../fonts/iconfont.svg?t=1522237704791#iconfont') format('svg'); /* iOS 4.1- */
}

.iconfont {
 font-family: "iconfont" !important;
 font-size: 16px;
 font-style: normal;
 -webkit-font-smoothing: antialiased;
 -moz-osx-font-smoothing: grayscale;
}

.icon-backtop:before {
 content: "\e689";
}

.icon-personal:before {
 content: "\e610";
}

.icon-scan:before {
 content: "\e609";
}

.icon-clear:before {
 content: "\e622";
}

.icon-msg:before {
 content: "\e7a8";
}

.icon-category:before {
 content: "\e7f9";
}

.icon-search:before {
 content: "\e616";
}

.icon-delete:before {
 content: "\e6ac";
}

.icon-service:before {
 content: "\e643";
}

.icon-setting:before {
 content: "\e64c";
}

.icon-back:before {
 content: "\e60f";
}

.icon-shop:before {
 content: "\e624";
}

.icon-close:before {
 content: "\e60c";
}

.icon-more:before {
 content: "\e85c";
}

.icon-home:before {
 content: "\e699";
}

.icon-collect:before {
 content: "\e78c";
}

.icon-cart:before {
 content: "\e635";
}

src/assets/scss/index.scss

@import 'icons';

*{
  margin:0;
  padding:0;
}
html,body{
  // 必须设置,否则内容滚动效果无法实现
  width:100%;
  height:100%;
}

总结

到此这篇关于vue开发移动端底部导航条功能的文章就介绍到这了,更多相关vue 移动端底部导航条内容请搜索三水点靠木以前的文章或继续浏览下面的相关文章希望大家以后多多支持三水点靠木!

Javascript 相关文章推荐
JavaScript判断两种格式的输入日期的正确性的代码
Mar 25 Javascript
通过隐藏option实现select的联动效果
Nov 10 Javascript
Colortip基于jquery的信息提示框插件在IE6下面的显示问题修正方法
Dec 06 Javascript
JQuery each()函数如何优化循环DOM结构的性能
Dec 10 Javascript
JQuery的$和其它JS发生冲突的快速解决方法
Jan 24 Javascript
使用 js+正则表达式为关键词添加链接
Nov 11 Javascript
JS继承用法实例分析
Feb 05 Javascript
jQuery实现鼠标划过展示大图的方法
Mar 09 Javascript
Javascript函数式编程语言
Oct 11 Javascript
JavaScript实现倒计时代码段Item1(非常实用)
Nov 03 Javascript
JavaScript encodeURI 和encodeURIComponent
Dec 04 Javascript
js使用xml数据载体实现城市省份二级联动效果
Nov 08 Javascript
《javascript设计模式》学习笔记五:Javascript面向对象程序设计工厂模式实例分析
Apr 08 #Javascript
vue实现表单未编辑或未保存离开弹窗提示功能
Apr 08 #Javascript
JS快速实现简单计算器
Apr 08 #Javascript
javascript中contains是否包含功能实现代码(扩展字符、数组、dom)
Apr 07 #Javascript
vue-cli3单页构建大型项目方案
Apr 07 #Javascript
在Chrome DevTools中调试JavaScript的实现
Apr 07 #Javascript
《javascript设计模式》学习笔记四:Javascript面向对象程序设计链式调用实例分析
Apr 07 #Javascript
You might like
杏林同学录(一)
2006/10/09 PHP
谈谈新手如何学习PHP
2006/12/14 PHP
php MySQL与分页效率
2008/06/04 PHP
laravel实现图片上传预览,及编辑时可更换图片,并实时变化的例子
2019/11/14 PHP
sina的lightbox效果。
2007/01/09 Javascript
jquery配合css简单实现返回顶部效果
2013/09/30 Javascript
javascript计时器事件使用详解
2014/01/07 Javascript
jQuery操作select下拉框的text值和value值的方法
2014/05/31 Javascript
Angular.JS中的this指向详解
2017/05/17 Javascript
js+html5生成自动排列对话框实例
2017/10/09 Javascript
JavaScript简单实现合并两个Json对象的方法示例
2017/10/16 Javascript
jQuery 防止相同的事件快速重复触发方法
2018/02/08 jQuery
详解vue指令与$nextTick 操作DOM的不同之处
2018/08/02 Javascript
vue里input根据value改变背景色的实例
2018/09/29 Javascript
5分钟快速看懂ES6中的反射与代理
2019/12/19 Javascript
关于Vue中$refs的探索浅析
2020/11/05 Javascript
[01:43]3.19DOTA2发布会 三代刀塔人第三代
2014/03/25 DOTA
[03:08]TI9战队档案 - Vici Gaming
2019/08/20 DOTA
python实现音乐下载器
2018/04/15 Python
对python numpy.array插入一行或一列的方法详解
2019/01/29 Python
python中的colorlog库使用详解
2019/07/05 Python
解决pyecharts运行后产生的html文件用浏览器打开空白
2020/03/11 Python
美津浓美国官网:Mizuno美国
2018/08/07 全球购物
美国礼品卡交易网站:Cardpool
2018/08/27 全球购物
巴西Mr. Cat在线商店:购买包包和鞋子
2019/09/08 全球购物
美国翻新电子产品商店:The Store
2019/10/08 全球购物
PHP中如何使用Cookie
2015/10/28 面试题
护士的岗位职责
2013/12/04 职场文书
材料物理专业个人求职信
2013/12/15 职场文书
中考冲刺决心书
2014/03/11 职场文书
2014机关党员干部“正风肃纪”思想汇报
2014/09/15 职场文书
学生偷窃检讨书
2014/09/25 职场文书
2015年高中班主任工作总结
2015/04/30 职场文书
交通肇事罪辩护词
2015/05/21 职场文书
升学宴学生致辞
2015/09/29 职场文书
2019年幼儿园家长接送责任书
2019/10/29 职场文书